1启动所有节点并检查主从状态,然后启动mycat测试数据库登录:
1.1启动节点,检查节点
[root@db01 ~]# systemctl start mysqld3307.service
[root@db01 ~]# systemctl start mysqld3308.service
[root@db01 ~]# systemctl start mysqld3309.service
[root@db01 ~]# systemctl start mysqld3310.service
[root@db01 ~]# mysql -S /data/3307/mysql.sock -e "show variables like 'server_id'"
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id | 7 |
+---------------+-------+
[root@db01 ~]# mysql -S /data/3308/mysql.sock -e "show variables like 'server_id'"
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id | 8 |
+---------------+-------+
[root@db01 ~]# mysql -S /data/3309/mysql.sock -e "show variables like 'server_id'"
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/data/3309/mysql.sock' (111)
[root@db01 ~]# mysql -S /data/3310/mysql.sock -e "show variables like 'server_id'"
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/data/3310/mysql.sock' (111)
处理报错:
删除失效的sock文件,然后重新启动mysql
[root@db01 ~]# rm -f /data/3309/mysql.sock*
[root@db01 ~]# rm -f /data/3309/mysql.sock*
[root@db01 ~]#
[root@db01 ~]#
[root@db01 ~]#
[root@db01 ~]#
[root@db01 ~]# systemctl start mysqld3309
[root@db01 ~]# ss -lntup |grep mysql
tcp LISTEN 0 80 [::]:3307 [::]:* users:(("mysqld",pid=980,fd=22))
tcp LISTEN 0 80 [::]:3308 [::]:* users:(("mysqld",pid=1017,fd=22))
tcp LISTEN 0 80 [::]:3309 [::]:* users:(("mysqld",pid=1761,fd=21))
[root@db01 ~]# rm -f /data/3310/mysql.sock*
[root@db01 ~]#
[root@db01 ~]#
[root@db01 ~]# systemctl start mysqld3310
[root@db01 ~]# ss -lntup |grep mysql
tcp LISTEN 0 80 [::]:3307 [::]:* users:(("mysqld",pid=980,fd=22))
tcp LISTEN 0 80 [::]:3308 [::]:* users:(("mysqld",pid=1017,fd=22))
tcp LISTEN 0 80 [::]:3309 [::]:* users:(("mysqld",pid=1761,fd=21))
[root@db01 ~]# ss -lntup |grep mysql
tcp LISTEN 0 80 [::]:3307 [::]:* users:(("mysqld",pid=980,fd=22))
tcp LISTEN 0 80 [::]:3308 [::]:* users:(("mysqld",pid=1017,fd=22))
tcp LISTEN 0 80 [::]:3309 [::]:* users:(("mysqld",pid=1761,fd=21))
[root@db01 ~]# ss -lntup |grep mysql
tcp LISTEN 0 80 [::]:3307 [::]:* users:(("mysqld",pid=980,fd=22))
tcp LISTEN 0 80 [::]:3308 [::]:* users:(("mysqld",pid=1017,fd=22))
tcp LISTEN 0 80 [::]:3309 [::]:* users:(("mysqld",pid=1761,fd=21))
[root@db01 ~]# ss -lntup |grep mysql
tcp LISTEN 0 80 [::]:3307 [::]:* users:(("mysqld",pid=980,fd=22))
tcp LISTEN 0 80 [::]:3308 [::]:* users:(("mysqld",pid=1017,fd=22))
tcp LISTEN 0 80 [::]:3309 [::]:* users:(("mysqld",pid=1761,fd=21))
[root@db01 ~]# ss -lntup |grep mysql
tcp LISTEN 0 80 [::]:3307 [::]:* users:(("mysqld",pid=980,fd=22))
tcp LISTEN 0 80 [::]:3308 [::]:* users:(("mysqld",pid=1017,fd=22))
tcp LISTEN 0 80 [::]:3309 [::]:* users:(("mysqld",pid=1761,fd=21))
[root@db01 ~]# ss -lntup |grep mysql
tcp LISTEN 0 80 [::]:3307 [::]:* users:(("mysqld",pid=980,fd=22))
tcp LISTEN 0 80 [::]:3308 [::]:* users:(("mysqld",pid=1017,fd=22))
tcp LISTEN 0 80 [::]:3309 [::]:* users:(("mysqld",pid=1761,fd=21))
[root@db01 ~]# ss -lntup |grep mysql
tcp LISTEN 0 80 [::]:3307 [::]:* users:(("mysqld",pid=980,fd=22))
tcp LISTEN 0 80 [::]:3308 [::]:* users:(("mysqld",pid=1017,fd=22))
tcp LISTEN 0 80 [::]:3309 [::]:* users:(("mysqld",pid=1761,fd=21))
tcp LISTEN 0 80 [::]:3310 [::]:* users:(("mysqld",pid=1801,fd=18))
1.2分别检查db01和db02两个节点的主从状态:
mysql -S /data/3307/mysql.sock -e "show slave status\G"|grep Yes
mysql -S /data/3308/mysql.sock -e "show slave status\G"|grep Yes
mysql -S /data/3309/mysql.sock -e "show slave status\G"|grep Yes
mysql -S /data/3310/mysql.sock -e "show slave status\G"|grep Yes
1.3启动db01中的mycat:
[root@db01 ~]# cd /application/mycat
[root@db01 mycat]# ls
bin catlet conf lib logs tmlogs version.txt
[root@db01 mycat]# mycat strt
Usage: /application/mycat/bin/mycat { console | start | stop | restart | status | dump }
[root@db01 mycat]# mycat start
Starting Mycat-server...
Mycat-server is already running.
[root@db01 mycat]# mysql -uroot -p123 -h 127.0.0.1 -P8066
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (HY000): Access denied for user 'root', because password is error
[root@db01 mycat]# mysql -uroot -p123456 -h 127.0.0.1 -P8066
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.29-mycat-1.6.5-release-20180122220033 MyCat Server (OpenCloundDB)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>