Ubuntu之MaxScale安装配置

原文github:https://github.com/mariadb-corporation/MaxScale/blob/develop/Documentation/Documentation-Contents.md

参考 github上的说明,在Ubuntu上做以下处理即可:

  1.安装相关命令:

 sudo apt-get install git build-essential libssl-dev libaio-dev ncurses-dev bison flex cmake perl libtool libcurl4-openssl-dev libpcre3-dev tcl

 tcl-dev  uuid uuid-dev

  2.从GitHub上拷贝MaxScale:

 git clone https://github.com/mariadb-corporation/MaxScale

  3.创建一个build文件夹,并进入:

    mkdir build

    cd build

  4.配置构建参数【build】:
    cmake ../MaxScale -DBUILD_TESTS=Y

  5.一旦参数配置完成,就可以进行编译、测试和安装MaxScale

    make

    make test

    sudo make install

安装路径说明:

  配置模板文件和相关说明文件位于 /usr/local/share/maxscale目录下

  配置文件为:/etc/maxscale.cnf

  启动文件为:/etc/init.d/maxscale

  Log文件:/var/log/maxscale

  Cache:/var/cache/maxscale

  bin文件:/usr/local/bin/maxscale

相关参考:   http://www.yunweipai.com/archives/9148.html 

                 http://blog.5ibc.net/p/68683.html

使用:

在开始配置前,要在Master为MaxScale创建两个用户,用于监控模块和路由模块。

创建监控用户:scalemon   123456

创建路由用户:maxscale  123456

用户创建完成后,开始配置

vi /etc/maxscale.cnf

找到 [server1] 部分,修改其中的 address 和 port,指向 master 的 IP 和端口。

复制2次 [server1] 的整块儿内容,改为 [server2] 与 [server3],同样修改其中的 address 和 port,分别指向 slave1 和 slave2,可参考如下:

[maxscale]
threads=1
log_info=1
logdir=/var/log/maxscale/
datadir=/usr/local/var/lib/maxscale/data/
# default is true.when all slave dumped ,master is read-writeable.
detect_stale_master=false
#default is true,means master can handle read
master_accept_reads=false

[server1]
type=server
address=192.168.7.222
port=3306
protocol=MySQLBackend
[server2]
type=server
address=192.168.7.224
port=3306
protocol=MySQLBackend
[server3]
type=server
address=192.168.7.223
port=3306
protocol=MySQLBackend

[MySQL Monitor]
type=monitor
module=mysqlmon
servers=server1,server2,server3
user=scalemon
passwd=9E509EC08A55148962B5CA53A64211C1
monitor_interval=1000

[Read-Write Service]
type=service
router=readwritesplit
servers=server1,server2,server3
user=maxscale
passwd=9E509EC08A55148962B5CA53A64211C1
max_slave_connections=100%

[MaxAdmin Service]
type=service
router=cli
[MaxAdmin Listener]
type=listener
service=MaxAdmin Service
protocol=maxscaled
address=localhost
port=6603

[Read-Write Listener]
type=listener
service=Read-Write Service
protocol=MySQLClient
port=4006

passwd使用的是加密

由maxkeys创建位于datadir下的.secrets文件,maxpasswd 进行加密。

如下:

会生成加密后的密码。

启动maxscale 管理器maxadmin 及进行测试,可参考上述资料。

 如果有其他问题,可在此提问:

  Email: maxscale@googlegroups.com
  Forum: http://groups.google.com/forum/#!forum/maxscale
原文地址:https://www.cnblogs.com/itdev/p/6032237.html