Mycat HA(高可用) 与 LB(负载均衡)10

2021-12-02 09:45:42 浏览数 (2)

以相同的方式打开 9066、8888、9999

Port

Comment

8066

默认服务端口 <property name="serverPort">8066</property>

9066

默认管理端口 <property name="managerPort">9066</property>

8888

haproxy对外的mycat服务端口

9999

haproxy对外的mycat管理端口

代码语言:javascript复制
[root@h101 ~]# iptables -L -nv | grep -E "(8066|9066|8888|9999)"
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:8066 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:9066 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:8888 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:9999 
[root@h101 ~]# 

启动mycat

代码语言:javascript复制
[root@h101 bin]# ./mycat  start 
Starting Mycat-server...
[root@h101 bin]#
[root@h101 bin]# mysql -u cc -p -P 8066 -p -h 192.168.100.101
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.5.8-mycat-1.5-GA-20160217103036 MyCat Server (OpenCloundDB)

Copyright (c) 2000, 2015, 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> show databases;
 ---------- 
| DATABASE |
 ---------- 
| cctest   |
 ---------- 
1 row in set (0.00 sec)

mysql> use cctest;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
 ------------------ 
| Tables in cctest |
 ------------------ 
| abc              |
| catworld         |
 ------------------ 
2 rows in set (0.00 sec)

mysql> 
mysql> select * from abc;
 ---- ------ 
| id | name |
 ---- ------ 
|  2 | abc  |
|  6 | abc  |
| 10 | abc  |
|  4 | abc  |
|  8 | abc  |
|  1 | abc  |
|  5 | abc  |
|  9 | xxx  |
 ---- ------ 
8 rows in set (0.53 sec)

mysql>

Tip: 密切关注 mycat.logwrapper.log ,根据日志信息确认启动成功,如果有错误进行相应调整

0 人点赞