测试:
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h192.168.1.6 --port=3308 -e "select * from test2" group1 ---读写分离
Warning: Using a password on the command line interface can be insecure.
+------+
| id |
+------+
| 106 |
+------+
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h192.168.1.6 --port=3308 -e "select * from test2" group1
Warning: Using a password on the command line interface can be insecure.
+------+
| id |
+------+
| 56 |
+------+
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h192.168.1.6 --port=3308 -e "select * from test2" group1
Warning: Using a password on the command line interface can be insecure.
+------+
| id |
+------+
| 106 |
+------+
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h192.168.1.6 --port=3308 -e "insert into test2 values(111)" group1 ---插入主库
Warning: Using a password on the command line interface can be insecure.
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h192.168.1.6 --port=3308 -e "select * from test2" group1
Warning: Using a password on the command line interface can be insecure.
+------+
| id |
+------+
| 56 |
+------+
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h192.168.1.6 --port=3308 -e "select * from test2" group1
Warning: Using a password on the command line interface can be insecure.
+------+
| id |
+------+
| 106 |
| 111 |
+------+
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h192.168.1.6 --port=3308 -e "select * from test2" group1
Warning: Using a password on the command line interface can be insecure.
+------+
| id |
+------+
| 56 |
+------+
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h192.168.1.6 --port=3308 -e "select * from test2" group1
Warning: Using a password on the command line interface can be insecure.
+------+
| id |
+------+
| 106 |
| 111 |