【Cetus】Cetus-讀寫分離版

小亮520cl發表於2018-03-26
1.廢話不多說。詳細使用請檢視官方文件,本文主要記錄的是cetus的安裝心得



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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章