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 閱讀(1257) 評論(0)  編輯  收藏 所屬分類: GNU牛力
          主站蜘蛛池模板: 泽普县| 通海县| 津南区| 探索| 福安市| 宁晋县| 康马县| 全南县| 灯塔市| 九寨沟县| 宜州市| 唐海县| 鹤山市| 都匀市| 洛南县| 清徐县| 扬州市| 佛冈县| 平泉县| 宁蒗| 大城县| 长治市| 应用必备| 清水县| 新竹县| 措勤县| 桃江县| 沐川县| 汨罗市| 松溪县| 南涧| 六枝特区| 南康市| 甘德县| 铅山县| 扎囊县| 牡丹江市| 武汉市| 大英县| 历史| 洛宁县|