使用FREDATED引擎实现跨实例访问(二)

2014-11-24 17:10:19 · 作者: · 浏览: 1
]# service mysql start Starting MySQL.[ OK ] [root@rhel64a ~]# mysql -uroot -pxxx root@localhost[(none)]> select * from information_schema.engines where engine='federated'; +-----------+---------+--------------------------------+--------------+------+------------+ | ENGINE | SUPPORT | COMMENT | TRANSACTIONS | XA | SAVEPOINTS | +-----------+---------+--------------------------------+--------------+------+------------+ | FEDERATED | YES | Federated MySQL storage engine | NO | NO | NO | +-----------+---------+--------------------------------+--------------+------+------------+ root@localhost[(none)]> use test -- 创建基于FEDERATED引擎的表federated_engine root@localhost[test]> CREATE TABLE `federated_engine` ( -> `engine` varchar(64) NOT NULL DEFAULT '', -> `support` varchar(8) NOT NULL DEFAULT '', -> `comment` varchar(80) NOT NULL DEFAULT '' -> ) ENGINE=FEDERATED DEFAULT CHARSET=utf8 -> CONNECTION='mysql://remote_user:xxx@192.168.1.131:3406/tempdb/tb_engine'; Query OK, 0 rows affected (0.00 sec) -- 下面是创建后表格式文件 root@localhost[test]> system ls -hltr /var/lib/mysql/test total 12K -rw-rw---- 1 mysql mysql 8.5K Oct 24 08:22 federated_engine.frm --查询表federated_engine root@localhost[test]> select * from federated_engine limit 2; +------------+---------+---------------------------------------+ | engine | support | comment | +------------+---------+---------------------------------------+ | MRG_MYISAM | YES | Collection of identical MyISAM tables | | CSV | YES | CSV storage engine | +------------+---------+---------------------------------------+ --更新表federated_engine root@localhost[test]> update federated_engine set support='NO' where engine='CSV'; Query OK, 1 row affected (0.03 sec) Rows matched: 1 Changed: 1 Warnings: 0 --查看更新后的结果 root@localhost[test]> select * from federated_engine where engine='CSV'; +--------+---------+--------------------+ | engine | support | comment | +--------+---------+--------------------+ | CSV | NO | CSV storage engine | +--------+---------+--------------------+

5、创建FEDERATED引擎表的链接方式

scheme: A recognized connection protocol. Only mysql is supported as the scheme value at this point.

链接示例样本:

6、涉及到的相关参考