【Cetus】Cetus-读写分离版

1.废话不多说。详细使用请查看官方文档,本文主要记录的是cetus的安装心得
https://github.com/Lede-Inc/cetus/blob/master/doc/cetus-rw-admin.md


1.user.json需要注意的地方
  1. [root@iZ2ze66bhrbxkc31nljgjnZ cetus_rw]# more conf/users.json
  2. {
  3.         "users": [{
  4.                         "user": "appuser1",         ----应用用户
  5.                         "client_pwd": "123",        ----client用户
  6.                         "server_pwd": "ESBecs00"    ----链接mysql数据库的用户
  7.                 }, {
  8.                         "user": "devuser",
  9.                         "client_pwd": "123",
  10.                         "server_pwd": "ESBecs00"
  11.                 }]
  12. }


2.proy.conf需要注意的地方
  1. [root@iZ2ze66bhrbxkc31nljgjnZ cetus_rw]# more conf/proxy.conf
  2. [cetus]
  3. daemon = true

  4. # Loaded Plugins
  5. plugins=proxy,admin

  6. # Proxy Configuration
  7. proxy-address=127.0.0.1:1234                            ----proxy端口,
  8. proxy-backend-addresses=47.93.243.162:3306
  9. proxy-read-only-backend-addresses=47.93.243.162:3308    ---mysql后端

  10. # Admin Configuration
  11. admin-address=127.0.0.1:5678                            -----管理端口
  12. admin-username=admin 
  13. admin-password=admin

  14. # Backend Configuration
  15. default-db=test
  16. default-username=appuser1                               -----默认用户(必须是user里面的)

  17. # File and Log Configuration
  18. log-file=cetus.log
  19. log-level=debug



测试应用端
  1. [root@iZ2ze66bhrbxkc31nljgjnZ ~]# mysql -uappuser1 -p123 -P1234 -h127.0.0.1 devops
  2. Warning: Using a password on the command line interface can be insecure.


  3. mysql> select database();
  4. +------------+
  5. | database() |
  6. +------------+
  7. | devops |
  8. +------------+
  9. 1 row in set (0.01 sec)

  10. mysql> quit
  11. Bye
  12. [root@iZ2ze66bhrbxkc31nljgjnZ ~]# mysql -udevuser -p123 -P1234 -h127.0.0.1 devops
  13. Warning: Using a password on the command line

  14. mysql>

 
读写分离测试通过,过程懒得写了!
后台管理
  1. [root@iZ2ze66bhrbxkc31nljgjnZ ~]# mysql -uadmin -padmin -P5678 -h127.0.0.1
  2. Warning: Using a password on the command line interface can be insecure.
  3. Welcome to the MySQL monitor. Commands end with ; or \g.
  4. Your MySQL connection id is 1
  5. Server version: cetus 0.8.8 admin

  6. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.

  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  11. mysql> SELECT * FROM backends;
  12. +-------------+--------------------+-------+------+-------------+------+------------+------------+-------------+
  13. | backend_ndx | address | state | type | slave delay | uuid | idle_conns | used_conns | total_conns |
  14. +-------------+--------------------+-------+------+-------------+------+------------+------------+-------------+
  15. | 1 | 47.93.243.162:3306 | up | rw | NULL | NULL | 2 | 0 | 2 |
  16. | 2 | 47.93.243.162:3308 | up | ro | 0 | NULL | 2 | 0 | 2 |
  17. +-------------+--------------------+-------+------+-------------+------+------------+------------+-------------+
  18. 2 rows in set (0.00 sec)



连接cetus中间件Hang住怎么办

https://mp.weixin.qq.com/s/KC0ucH-w5kr3tR5IgUiOAw

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29096438/viewspace-2152221/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29096438/viewspace-2152221/

你可能感兴趣的:(【Cetus】Cetus-读写分离版)