当前位置: 澳门新濠3559 > 数据库 > 正文

    编写mysql-proxy实现读写分离的脚本   ,还是

时间:2019-12-09 01:06来源:数据库
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #!/bin/sh # 切割Atlas的访问日志,同时清理15天之前的日志 # PATH= /sbin : /bin : /usr/sbin : /usr/bin : /usr/local/bin : /usr/local/sbin     ## mysql-proxy日志路径
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# 切割Atlas的访问日志,同时清理15天之前的日志
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
  
## mysql-proxy日志路径
LOGPATH="/usr/local/mysql-proxy/log"
  
[[ `/sbin/ip addr show eth1 | grep inet | wc -l` -eq 2 ]] || exit 
cd ${LOGPATH}
  
## 日志切割
HISTORY_LOG_PATH=`date -d '-1 hour' +"%Y-%m-%d/sql_mysql-proxy_%H.log"`
[[ -d `dirname ${HISTORY_LOG_PATH}` ]] || mkdir -p `dirname ${HISTORY_LOG_PATH}`
cp -a sql_mysql-proxy.log ${HISTORY_LOG_PATH}
  
echo > sql_mysql-proxy.log
  
## 日志清理
HISTORY_LOG_PATH=`date -d '15 days ago' +'%Y-%m-%d'`
[[ -d ${HISTORY_LOG_PATH} ]] && rm -rf ${HISTORY_LOG_PATH}

    # /etc/init.d/mysql-proxy start  

# chmod +x /data/scripts/*.sh

6、安装mysql-proxy

(4卡塔尔(قطر‎、支持从DB读负载均衡,并机关删除故障从DB;

    # ./configure --prefix=/opt/module/glib2   

linux:

    # make linux INSTALL_TOP= /usr/local/lua   

LDFLAGS="-L/usr/local/lib -L/usr/local/lib64 -lm -ldl -lcrypto"

        local max_conns_ndx=0   

 

    else  

# ./configure --prefix=/usr/local

    proxy-lua-script = /opt/module/mysql-proxy/rw-splitting.lua   

3、crontab内容丰硕

    ===================   

# touch /var/lock/check_service.lock

    =====================   

澳门新濠3559 1

4、安装pkg-config

 

    export PKG_CONFIG_PATH="/usr/lib/pkgconfig/"  

2、Atlas访谈日志切割

    ===================   

# cd libevent-2.0.21-stable

    admin-password = 123456   

-DMYSQL_UNIX_ADDR=/var/run/mysql/mysql.sock

    end   

==========================================================================================

    # wget   

# chkconfig --add keepalived

    制作运营脚本:   

# cd glib-2.32.4

    # tar xzf mysql-proxy-0.8.1.tar.gz   

 

        mode="start"  

--with-libiconv=/usr/local

    fi   

 

 

ftp://sourceware.org/pub/libffi/libffi-3.0.13.tar.gz

    # tar xzf pkgconfig-0.18.tar.gz   

在“src/Makefile”文件中投入“-lncurses”,完整内容如下:

 

(2卡塔尔国、LUA库的本子不能够太高,为5.1.x就能够;

 

# ln -s /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d

    # ./configure --with-mysql="/opt/module/mysql" --prefix="/opt/module/mysql-proxy"   

# cd Atlas-2.2.1

        for i=1, #proxy.servers do  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
global_defs {
    notification_email {
        lovezym5@126.com
    }
  
    notification_email_from lovezym5@126.com
    smtp_server 127.0.0.1
    smtp_connect_timeout 30
    router_id dbproxy2
}
  
vrrp_script chk_mysql_proxy_health {
    script "/data/scripts/keepalived_check_mysql_proxy.sh"
    interval 1
    weight -2
}
  
vrrp_instance VI_1 {
    state BACKUP
    interface eth1
    virtual_router_id 51
    priority 90
    advert_int 1
    smtp_alert
  
    authentication {
        auth_type PASS
        auth_pass 123456
    }
  
    virtual_ipaddress {
        10.209.6.115
    }
  
    track_script {
        chk_mysql_proxy_health
    }
  
    notify_master "/data/scripts/notify.sh master"
    notify_bakcup "/data/scripts/notify.sh backup"
    notify_fault "/data/scripts/notify.sh fault"
}

            /opt/module/mysql-proxy/bin/mysql-proxy --defaults-file=/etc/mysql-proxy.cnf>/opt/module/mysql-proxy/log &   

在7880行之上加多如下内容:

    # chmod 0660 /etc/mysql-proxy.cnf   

 

# vim /usr/local/mysql-proxy/conf/mysql-proxy.cnf

    ============   

# ./config shared --prefix=/usr/local

            echo "Usage: $0 (start|stop)"  

# tar xvzf ncurses-5.9.tar.gz

1、安装MySQL 2、安装Lua # wget # tar xzf lua-5.1.4.tar.gz # cd lua-5.1.4 # make # make linux...

# cd libnl-3.2.24

    ============   

# cd mysql-5.5.24

    # ./configure --prefix=/opt/module/libevent   

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
global_defs {
    notification_email {
        lovezym5@126.com
    }
  
    notification_email_from lovezym5@126.com
    smtp_server 127.0.0.1
    smtp_connect_timeout 30
    router_id dbproxy1
}
  
vrrp_script chk_mysql_proxy_health {
    script "/data/scripts/keepalived_check_mysql_proxy.sh"
    interval 1
    weight -2
}
  
vrrp_instance VI_1 {
    state MASTER
    interface eth1
    virtual_router_id 51
    priority 100
    advert_int 1
    smtp_alert
  
    authentication {
        auth_type PASS
        auth_pass 123456
    }
  
    virtual_ipaddress {
        10.209.6.115
    }
  
    track_script {
        chk_mysql_proxy_health
    }
  
    notify_master "/data/scripts/notify.sh master"
    notify_bakcup "/data/scripts/notify.sh backup"
    notify_fault "/data/scripts/notify.sh fault"
}

    # vi /opt/module/mysql-proxy/rw-splitting.lua   

# ./bootstrap --prefix=/usr/local

        start)   

http://wwwNaNake.org/files/v2.8/cmake-2.8.10.2.tar.gz

        stop)   

(1卡塔尔国、本次安装不行使系统默许的glib库,之前的yum安装只是为了先解决注重库的主题材料;

    #    编写mysql-proxy实现读写分离的脚本   ,还是很出色的。 cd pkgconfig-0.18   

    ===================   

澳门新濠3559 2

    return proxy.PROXY_SEND_QUERY   

(1)、configure阶段

            killall -9 mysql-proxy   

# ln -s /usr/local/keepalived/sbin/keepalived /usr/sbin

            ;;   

--with-lua=/usr/local/lua

    # chmod +x /etc/init.d/mysql-proxy   

# crontab -uroot -e

    daemon = true  

 

    if is_in_transaction==0 and packet:byte() == proxy.COM_QUERY and packet:sub(2, 7)=="SELECT" then   

# chmod 0660 /usr/local/mysql-proxy/conf/mysql-proxy.cnf

        发送到主数据库   

# make && make install

    export CFLAGS="$CFLAGS -I/opt/module/libevent/include"  

# vim ./glib/gconvert.c

    export LUA_PATH=/opt/module/mysql-proxy/?.lua   

# yum -y install *glib*

    esac   

# cd libffi-3.0.13

 

留心:编写翻译报错处理

      C:Documents and SettingsAdministrator>"c:Program FilesOracleVirtualBox"VBoxManage internalcommands setvdiuuid E:HardDisks217.vdi

(5卡塔尔国、支持平滑上下线DB;

    proxy-read-only-backend-address = 192.168.1.224:3306 从   

1
2
3
4
5
6
7
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
  
if [[ `pgrep mysql-proxy | wc -l` -eq 0 ]]; then
    /sbin/service mysql-proxy start && sleep 5
    [[ -z `pgrep mysql-proxy` ]] && /sbin/service keepalived stop
fi

5、安装libevent

# cd openssl-1.0.1h

    # cd libevent-2.0.10-stable   

 

    # make install 

GMODULE_CFLAGS="-I/usr/local/glib-2.32.4/include"

    export GTHREAD_CFLAGS="-I/opt/module/glib2/include"  

当初大家为此选拔Atlas,首要相中它有以下优点:

    # wget   

# ln -s /usr/local/lib/libffi-3.0.13/include/ffi.h /usr/local/include

    启动mysql-proxy   

# cd popt-1.14

    exit 0;   

# ps aux | grep mysql-prox[y]

            ;;   

# tar -xvzf mysql-5.5.24.tar.gz

    keepalive = true  

注意:

    

(4卡塔尔、对于编写翻译不成功的情况,注意查看上面包车型地铁认证。

    # /opt/module/mysql-proxy/bin/mysql-proxy --help-all | less   

(7卡塔尔、版本更新、难点跟进、交换天地都相比外向。

    [mysql-proxy]   

-DWITH_EMBEDDED_SERVER=1

mysql数据抽离(mysql-proxy配置)

 

3、安装glib

(6卡塔尔(英语:State of Qatar)、具备较好的平安机制(IP过滤、账号认证);

    export LIBS="/opt/module/glib2/lib/libgthread-2.0.so /opt/module/glib2/lib/libgmodule-2.0.so"  

-DWITH_READLINE=1

    # ./configure && make && make install 

# ./configure --prefix=/usr/local/mysql-proxy

    # cd lua-5.1.4   

==========================================================================================

    export GMODULE_CFLAGS="-I/opt/module/glib2/include" GMODULE_LIBS="-L/opt/module/glib2/lib"  

3、LUA库安装

    case $mode in   

(2卡塔尔、备用节点配置

    # cd glib-2.28.4   

 

   配置:   

# ./configure --prefix=/usr/local

    # ldconfig  

-DDEFAULT_CHARSET=utf8

    #!/bin/sh   

# make && make install

 

2、GLIB倚重的根基库安装

 

            if s.type==proxy.BACKEND_TYPE_RO and s.idling_connections>0 then   

申明掉第26、28行的剧情

瞩目:copy虚构机的设想硬盘比如219.vdi,重命名为218.vdi,那个时候用virtualbox来创造一个虚构主机,间接连接那个硬盘使用,会提醒uuid重复的唤醒,那是用virtualbox的中间命令能够缓慢解决:

(3卡塔尔国、帮忙DB读写抽离;

    export LDFLAGS="$LDFLAGS -L/opt/module/libevent/lib -lm"  

# mv mysql-proxy atlas-2.2.1 && ln -s atlas-2.2.1 mysql-proxy

            exit 1   

 

    # wget   

 

    proxy-read-only-backend-address = 192.168.1.222:3306 从   

GTHREAD_LIBS="-L/usr/local/glib-2.32.4/lib -lgthread-2.0"

    # wget   

CFLAGS="-DHAVE_LUA_H -O2"

        local max_conns=-1   

# make && make install

 

# tar xvzf Atlas-2.2.1.tar.gz

    # tar jxf glib-2.28.4.tar.bz2   

澳门新濠3559 3

    if [ -z $mode ] ; then   

# ./configure --prefix=/usr/local

    # vi /etc/mysql-proxy.cnf   

# ln -s /usr/local/include/libnl3/netlink /usr/local/include

    发送全数的非事务性select到三个从数据库   

(3卡塔尔(قطر‎、VIP切换通知脚本

    # make && make install   

二、安装配置

 

 

        *)   

# ./configure --prefix=/usr/local

    # make; make install  

5、Atlas安装

    # vi /etc/init.d/mysql-proxy   

# vim /data/scripts/keepalived_check_mysql_proxy.sh

    admin-lua-script  = /opt/module/mysql-proxy/lib/mysql-proxy/lua/admin.lua   

# vim /usr/local/mysql-proxy/bin/check_service.sh

    export CPPFLAGS="$CPPFLAGS -I/opt/module/libevent/include"  

1、需注意的地点

            local s=proxy.servers[i] 需求选用二个全部空闲连接的从数据库   

        $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lncurses -lreadline"

    # tar zxf libevent-2.0.10-stable.tar.gz   

CentOS 6.3 x86_64

2、安装Lua     

(3卡塔尔(قطر‎、glib库的版本也不能够太高,为glib-2.32.x就能够;

                if max_conns==-1 or s.connected_clients<MAX_CONNS max_conns_ndx="i" if 至此,找到了三个独具空闲连接的从数据库 end max_conns="s.connected_clients" then>0 then   

(1卡塔尔、别的底子零件安装

            proxy.connection.backend_ndx=max_conns_ndx   

# make && make install

    编写mysql-proxy实现读写抽离的脚本   

 

        end   

# tar xvzf keepalived-1.2.10.tar.gz

    # tar xzf lua-5.1.4.tar.gz   

第一是为了制止与系统自带的lua库发生矛盾的或然

    admin-username = mysqlproxyadm 主从数据库都亟需的数据库客商   

# ln -s /usr/local/glib-2.32.4/lib/glib-2.0/include/glibconfig.h /usr/local/glib-2.32.4/include/glib-2.0

 

# make && make install

    # make   

# ln -s /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig

    # cd mysql-proxy-0.8.1   

# cd ncurses-5.9

    # export LUA_CFLAGS="-I/usr/local/include" LUA_LIBS="-L/usr/local/lib -llua -ldl" LDFLAGS="-lm"   

 

    proxy-backend-addresses = 192.168.1.223:3306 主   

# make --jobs=`grep processor /proc/cpuinfo | wc -l`

    # echo "/opt/module/glib2/lib" >> /etc/ld.so.conf   

改革当前目录下的“Makefile”中的 INSTALL_TOP= /usr/local为 INSTALL_TOP= /usr/local/lua

            ;;   

-DEXTRA_CHARSETS=all

    查看是还是不是安装成功:   

LUA_CFLAGS="-I/usr/local/lua/include"

    mode=$1;   

 

    log-level = debug   

# service keepalived start

    export GLIB_CFLAGS="-I/opt/module/glib2/include/glib-2.0 -I/opt/module/glib2/lib/glib-2.0/include" GLIB_LIBS="-L/opt/module/glib2/lib -lglib-2.0"  

# tar xvzf popt-1.14.tar.gz

    # wget   

# /sbin/ldconfig

1、安装MySQL

 

    export GTHREAD_LIBS="-L/opt/module/glib2/lib"  

-DDEFAULT_COLLATION=utf8_general_ci

    log-file = /opt/module/mysql-proxy/log   

 

# ./configure --prefix=/usr/local

 

# ./configure --prefix=/usr/local

澳门新濠3559 4

# make Linux install

# mkdir –p /etc/keepalived /data/scripts

8、Atlas高可用【Keepalived】配置

(2)、make阶段

生机勃勃、底蕴介绍

6、DB中间层配置

# make && make install

# cd /usr/local

三、别的设置

# chmod +x /etc/init.d/mysql-proxy

 

 

# make && make install

found_iconv=yes

(1卡塔尔、基于mysql-proxy-0.8.2进展改正,代码完全开源;

 

# vim /etc/keepalived/keepalived.conf

--with-mysql=/usr/local/mysql

-DWITH_INNOBASE_STORAGE_ENGINE=1

# echo 'touch /var/lock/check_service.lock' >> /etc/rc.d/rc.local

(4卡塔尔、DB中间层进度检查脚本

==========================================================================================

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
  
[[ $# -ne 3 ]] && echo "$0 端口号 协议类型 服务名" && exit 1
  
SRV_PORT=$1  ## 端口号
SRV_PROT=$2  ## 协议类型
SRV_NAME=$3  ## 服务名
  
MONITOR="/usr/local/oms/agent/alarm/BusMonitorAgent"
TOKEN="ha_monitor"
  
TITLE="${SRV_NAME}服务异常监控"
CONTENT="${SRV_NAME}服务发生异常,已自动拉起!"
  
## 是否已正确扫描
SCAN_FLAG=0
  
function RESTART_SRV_AND_ALERT() 
{
    local CUR_SRV_NAME
     
    [[ $# -ne 1 ]] && exit 1
    CUR_SRV_NAME=$1
     
    TMP_SRV_NAME=`echo ${CUR_SRV_NAME} | tr '[A-Z]' '[a-z]'`
    [[ ! -f /etc/init.d/${TMP_SRV_NAME} ]] && TMP_SRV_NAME="${TMP_SRV_NAME}d"
     
    killall -9 ${TMP_SRV_NAME}
     
    if [[ -z `ps aux | grep ${TMP_SRV_NAME} | grep -v grep` ]]; then
        /sbin/service ${TMP_SRV_NAME} start >/dev/null 2>&1
    fi
     
    ${MONITOR} -c 2 -f ${TOKEN} -t "${TITLE}" -i "${CONTENT}"
    rm -f `pwd`/connect_error.log
}
  
ETH1_ADDR=`/sbin/ifconfig eth1 | awk -F ':' '/inet addr/{print $2}' sed 's/[a-zA-Z ]//g'`
TMP_SRV_PROT=`echo ${SRV_PROT} | tr '[A-Z]' '[a-z]'`
 
if [[ "${TMP_SRV_PROT}" == "tcp" ]]; then
    PROT_OPT="S"
elif [[ "${TMP_SRV_PROT}" == "udp" ]]; then
    PROT_OPT="U"
else
    echo "未知的协议类型!" && exit 1
fi
  
## 最多扫描3次,成功一次即可,以避免网络抖动而导致误判
for ((i=0; i<3; i++)); do
    RETVAL=`/usr/bin/nmap -n -s${PROT_OPT} -p ${SRV_PORT} ${ETH1_ADDR} | grep open`
    [[ -n "${RETVAL}" ]] && SCAN_FLAG=1;break || sleep 10
done
  
## 1、针对Atlas服务端口不通的情况,也就是服务彻底挂掉
[[ ${SCAN_FLAG} -ne 1 ]] && RESTART_SRV_AND_ALERT ${SRV_NAME}
  
## 2、检查Atlas服务是否正常工作,也就是服务端口正常,但访问异常的情况【高权限DB用户】
mysqladmin -h${ETH1_ADDR} -uhealth_check1 -p123456 --connect-timeout=15 --shutdown-timeout=15 ping
[[ $? -ne 0 ]] && RESTART_SRV_AND_ALERT ${SRV_NAME}
  
## 3、检查Atlas服务是否正常工作,也就是服务端口正常,高权限DB用户访问也正常,但低权限
##    DB用户访问异常的情况【低权限DB用户】
mysqladmin -h${ETH1_ADDR} -uhealth_check2 -p123456 --connect-timeout=15 --shutdown-timeout=15 ping
[[ $? -ne 0 ]] && RESTART_SRV_AND_ALERT ${SRV_NAME}

-DMYSQL_DATADIR=/data/dbdata/data

 

# ./configure --prefix=/usr/local/keepalived

# tar xvzf libevent-2.0.21-stable.tar.gz

LIBFFI_LIBS="-L/usr/local/lib -lffi"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
#
# mysql-proxy This script starts and stops the mysql-proxy daemon
#
# chkconfig: - 78 30
# processname: mysql-proxy
# description: mysql-proxy is a proxy daemon to mysql
# config: /usr/local/mysql-proxy/conf/mysql-proxy.cnf
# pidfile: /usr/local/mysql-proxy/log/mysql-proxy.pid
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  
DAEMON="/usr/local/mysql-proxy/bin/mysql-proxy"
CONFIGFILE="/usr/local/mysql-proxy/conf/mysql-proxy.cnf"
PIDFILE="/usr/local/mysql-proxy/log/mysql-proxy.pid"
LOCKFILE="/var/lock/subsys/mysql-proxy"
PROG=`basename $DAEMON`
  
RETVAL=0
  
start() {
    echo -n $"Starting ${PROG}......"
    [ -x $DAEMON ] || exit 5
    [ -f $CONFIGFILE ] || exit 6
    ${DAEMON} --defaults-file=${CONFIGFILE} || echo -n "${PROG} already running"
  
    RETVAL=$?
    echo
    [[ $RETVAL -eq 0 ]] && touch $LOCKFILE
  
    return $RETVAL
}
  
stop() {
    echo -n $"Stopping ${PROG}......"
    if [[ `ps aux | grep bin/mysql-proxy grep -v grep wc -l` -gt 0 ]]; then
        kill -TERM `ps -A -oppid,pid,cmd | grep bin/mysql-proxy grep -v grep awk '{print $2}'`
    fi
  
    RETVAL=$?
    echo
    [[ $RETVAL -eq 0 ]] && rm -f $LOCKFILE $PIDFILE
  
    return $RETVAL
}
  
restart() {
    stop
    sleep 1
    start
}
  
case "$1" in
start)
    start
    ;;
  
stop)
    stop
    ;;
  
restart)
    restart
    ;;
  
condrestart)
    [[ -e $LOCKFILE ]] && restart
    ;;
  
*)
    echo "Usage: $0 {start|stop|restart|condrestart}"
    RETVAL=1
    ;;
esac
  
exit $RETVAL

编写翻译报错管理

(2卡塔尔国、相当轻量级,铺排安插也比较容易;

(2卡塔尔(英语:State of Qatar)、运维脚本

# ./configure --prefix=/usr/local/glib-2.32.4

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
  
KEEPALIVE_CONF="/etc/keepalived/keepalived.conf"
  
VIP=`grep -A 1 virtual_ipaddress ${KEEPALIVE_CONF} | tail -1 | sed 's/t//g; s/ //g'`
ETH1_ADDR=`/sbin/ifconfig eth1 | awk '/inet addr:/{print $2}' awk -F: '{print $2}'`
  
MONITOR="/usr/local/oms/agent/alarm/BusMonitorAgent"
TOKEN="ha_monitor"
  
function notify() {
    TITLE="$ETH1_ADDR to be $1: $VIP floating"
    CONTENT="vrrp transition, $ETH1_ADDR changed to be $1"
    ${MONITOR} -c 2 -f ${TOKEN} -t "${TITLE}" -i "${CONTENT}"
}
  
case "$1" in
master)
    notify master
    exit 0
    ;;
  
backup)
    notify backup
    exit 0
    ;;
  
fault)
    notify fault
    exit 0
    ;;
  
*)
    echo 'Usage: `basename $0` {master|backup|fault}'
    exit 1
    ;;
esac

# tar -xvzf cmake-2.8.10.2.tar.gz

# tar xvzf readline-6.2.tar.gz

# make && make install

#澳门新濠3559, /sbin/ldconfig

GMODULE_LIBS="-L/usr/local/glib-2.32.4/lib -lgmodule-2.0"

# cd xz-5.0.5

LUA_LIBS="-L/usr/local/lua/lib -llua-5.1"

# vim ./configure

# ip addr show eth1

 

# vim /data/scripts/cut_and_clear_access_log.sh

 

# xz -d glib-2.32.4.tar.xz

# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql

(1)、主配置

(3卡塔尔国、DB中间件安装

# tar xvzf libffi-3.0.13.tar.gz

# ./configure --prefix=/usr/local

glib库供给安装在独立的目录“/usr/local/glib-2.32.4”,也是为着制止与系统自带的glib库爆发冲突的恐怕

# cd cmake-2.8.10.2

GLIB_CFLAGS="-I/usr/local/glib-2.32.4/include/glib-2.0"

GLIB_LIBS="-L/usr/local/glib-2.32.4/lib/glib-2.0 -lglib-2.0"

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[mysql-proxy]
admin-username = sysadmin
admin-password = admin2356!@()
  
proxy-backend-addresses = 10.222.5.224:3306
proxy-read-only-backend-addresses = 10.240.95.107:3306,10.240.95.108:3306
  
pwds = health_check1:/iZxz+0GRoA=,health_check2:/iZxz+0GRoA=
  
daemon = true
keepalive = true
  
event-threads = 16
  
log-level = message
log-path = /usr/local/mysql-proxy/log
sql-log = ON
  
proxy-address = 0.0.0.0:3306
admin-address = 10.209.6.101:3307
  
charset = utf8

# make && make install

# mysql -h10.209.6.101 -P3307 -usysadmin -p'admin2356!@()'

1
2
* * * * * (flock --timeout=0 /var/lock/check_service.lock /usr/local/mysql-proxy/bin/check_service.sh 3306 tcp mysql-proxy >/dev/null 2>&1)
00 * * * * /data/scripts/cut_and_clear_access_log.sh >/dev/null 2>&1

# gmake install

 

# make install

# tar xvzf lua-5.1.5.tar.gz

 

# tar xvzf libiconv-1.14.tar.gz

在测试以内以致线上难题排查进度中,获得了360 Atlas小编朱超的古貌古心解答,在那表示多谢。有关更加多Atlas的牵线,笔者就不生机勃勃意气风发例举,能够参照以下链接:

# cd keepalived-1.2.10

 

GTHREAD_CFLAGS="-I/usr/local/glib-2.32.4/include"

4、GLIB库安装

# gmake --jobs=`grep processor /proc/cpuinfo | wc -l`

-DWITH_MYISAM_STORAGE_ENGINE=1

 本文来源转载外人博客

# cd libiconv-1.14

1、背景描述

3、系统遇到

 

# vim /etc/init.d/mysql-proxy

这段时间大家的高可用DB的代理层选用的是360开源的Atlas,从上线以来,已平稳运营2个多月。无论是从性质上,依然水静无波上,比较此外开源组件(amoeba、cobar、MaxScale、MySQL-Proxy等),照旧很可观的。

# ps aux | grep keepalive[d]

 

-DENABLED_LOCAL_INFILE=1

# cd lua-5.1.5

2、总体架构图

# vim /etc/keepalived/keepalived.conf

# vim /data/scripts/notify.sh

澳门新濠3559 5

# ln -s /usr/local/lib/libffi-3.0.13/include/ffitarget.h /usr/local/include

# make && make install

澳门新濠3559 6

注意:

-DMYSQL_TCP_PORT=3306

# service mysql-proxy start

# ./configure --prefix=/usr/local

# tar xvzf libnl-3.2.24.tar.gz

 

7、Atlas高可用【Keepalived】意况设置

# make && make install

(1卡塔尔(英语:State of Qatar)、主节点配置

 

 

讲解掉从61行到67行的剧情

# tar xvzf openssl-1.0.1h.tar.gz

==========================================================================================

1、Atlas服务监察和控制

ftp://ftp.gnu.org/gnu/readline/readline-6.2.tar.gz

LIBFFI_CFLAGS="-I/usr/local/include"

# rm-f CMakeCache.txt

==========================================================================================

# make && make install

 

# tar xvzf xz-5.0.5.tar.gz

 

(2卡塔尔(英语:State of Qatar)、MySQL安装(无需运行)

# cd readline-6.2

# tar -xvf glib-2.32.4.tar

4、平滑设置效用

编辑:数据库 本文来源:    编写mysql-proxy实现读写分离的脚本   ,还是

关键词:

  • 上一篇:没有了
  • 下一篇:没有了