ivaneeo's blog

自由的力量,自由的生活。

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  669 Posts :: 0 Stories :: 64 Comments :: 0 Trackbacks
1.安装mariadb on ubuntu
http://blog.secaserver.com/2013/07/install-mariadb-galera-cluster-ubuntu/

3 在服务器上用mysql -h 192.168.0.1 -u root -p mysql命令登录mysql数据库

然后用grant命令下放权限。

GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY 'root-password' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON *.* TO root@127.0.0.1 IDENTIFIED BY 'root-password' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'root-password' WITH GRANT OPTION;

例如:
GRANT   ALL   PRIVILEGES   ON   *.*   TO   root@'%'   identified   by   '123456'  

注意:自己根据情况修改以上命令中的 “用户”“ip地址”“密码”。 

2 安装和配置haproxy
option mysql-check [ user <username> ]   
USE mysql; INSERT INTO user (Host,User) values ('<ip_of_haproxy>','<username>'); FLUSH PRIVILEGESheck

only consists in parsing the Mysql Handshake Initialisation packet or Error packet, we don't send anything in this mode. It was reported that it can generate lockout if check is too frequent and/or if there is not enough traffic. In fact, you need in this case to check MySQL "max_connect_errors" value as if a connection is established successfully within fewer than MySQL "max_connect_errors" attempts after a previous connection was interrupted, the error count for the host is cleared to zero. If HAProxy's server get blocked, the "FLUSH HOSTS" statement is the only way to unblock it.

配置:
# this config needs haproxy-1.1.28 or haproxy-1.2.1 global
log 127.0.0.1
local0 info
#日志相关
log 127.0.0.1
local1 notice
maxconn 4096
daemon
#debug
#quiet defaults
log global mode http #option httplog option dontlognull retries 3 option redispatch maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout 50000 listen mysql bind 0.0.0.0:3333 #代理端口 mode tcp #模式 TCP option mysql-check user haproxy #mysql健康检查 root为mysql登录用户名 balance roundrobin #调度算法 server mysql1 172.20.21.1:3306 weight 1 check inter 1s rise 2 fall 2 server mysql2 172.20.21.2:3306 weight 1 check inter 1s rise 2 fall 2 server mysql3 172.20.21.3:3306 weight 1 check inter 1s rise 2 fall 2 listen stats :1936 mode http stats enable stats hide-version stats realm Haproxy\ Statistics stats uri / stats auth admin:admin
posted on 2013-12-22 02:57 ivaneeo 阅读(1228) 评论(0)  编辑  收藏 所属分类: GNU牛力

只有注册用户登录后才能发表评论。


网站导航: