MariaDB Proxy读写分离的实现_MySQL
MariaDB Proxy读写分离的实现
1.创建用于存储数据目录lvm设备
安装mysql-proxy-0.8.3
MariaDB 的详细介绍:请点这里
MariaDB 的下载地址:请点这里
--------------------------------------分割线 --------------------------------------
推荐阅读:
在CentOS/RHEL/Scientific Linux 6 下安装 LAMP (Apache with MariaDB and PHP)http://www.linuxidc.com/Linux/2013-07/86755.htm
Haproxy+Keepalived搭建Weblogic高可用负载均衡集群http://www.linuxidc.com/Linux/2013-09/89732.htm
Keepalived+HAProxy配置高可用负载均衡http://www.linuxidc.com/Linux/2012-03/56748.htm
CentOS 6.3下Haproxy+Keepalived+Apache配置笔记http://www.linuxidc.com/Linux/2013-06/85598.htm
Haproxy + KeepAlived 实现WEB群集 on CentOS 6http://www.linuxidc.com/Linux/2012-03/55672.htm
Haproxy+Keepalived构建高可用负载均衡http://www.linuxidc.com/Linux/2012-03/55880.htm
--------------------------------------分割线 --------------------------------------
为mysql-proxy提供SysV服务脚本,内容如下所示
#vim /etc/rc.d/init.d/mysql-proxy
#!/bin/bash
#
# mysql-proxy Thisscript starts and stops the mysql-proxy daemon
#
# chkconfig: - 7830
# processname:mysql-proxy
# description:mysql-proxy is a proxy daemon for mysql
# Source functionlibrary.
./etc/rc.d/init.d/functions
prog="/usr/local/mysql-proxy/bin/mysql-proxy"
# Sourcenetworking configuration.
if [ -f/etc/sysconfig/network ]; then
. /etc/sysconfig/network
fi
# Check thatnetworking is up.
[ ${NETWORKING} = "no"] && exit 0
# Set defaultmysql-proxy configuration.
ADMIN_USER="admin"
ADMIN_PASSWD="admin"
ADMIN_LUA_SCRIPT="/usr/local/mysql-proxy/share/doc/mysql-proxy/admin.lua"
PROXY_OPTIONS="--daemon"
PROXY_PID=/var/run/mysql-proxy.pid
PROXY_USER="mysql-proxy"
# Sourcemysql-proxy configuration.
if [ -f/etc/sysconfig/mysql-proxy ]; then
. /etc/sysconfig/mysql-proxy
fi
RETVAL=0
start() {
echo -n $"Starting $prog: "
daemon $prog $PROXY_OPTIONS--pid-file=$PROXY_PID --proxy-address="$PROXY_ADDRESS"--user=$PROXY_USER --admin-username="$ADMIN_USER"--admin-lua-script="$ADMIN_LUA_SCRIPT"--admin-password="$ADMIN_PASSWORD"
RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
touch /var/lock/subsys/mysql-proxy
fi
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $PROXY_PID -d 3 $prog
RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/mysql-proxy
rm -f $PROXY_PID
fi
}
# See how we werecalled.
case"$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart|try-restart)
if status -p $PROXY_PIDFILE $prog>&/dev/null; then
stop
start
fi
;;
status)
status -p $PROXY_PID $prog
;;
*)
echo "Usage: $0{start|stop|restart|reload|status|condrestart|try-restart}"
RETVAL=1
;;
esac
exit$RETVAL
将上述内容保存为/etc/rc.d/init.d/mysql-proxy,给予执行权限,而后加入到服务列表。
#chmod +x /etc/rc.d/init.d/mysql-proxy
#chkconfig --add mysql-proxy
更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2014-05/101306p2.htm
推荐阅读
-
MariaDB Proxy读写分离的实现_MySQL
-
Ubuntu10下如何搭建MySQL Proxy读写分离探讨
-
Mysql 读写分离的 Java 实现 博客分类: 缓存和数据库 读写分离ThreadLocal
-
mysql 主从复制读写分离实现(详细) 博客分类: 数据库 Mysql主从读写分离master/slavemysql proxy
-
linux mysql proxy 的安装,配置,以及读写分离 博客分类: Mysql mysqlmysql proxy安装读写分离
-
提升数据库性能的重要手段--冗余 博客分类: 架构mysql 读写分离镜像同步非对称同步
-
mysql多端口实现多个实例以及mysqld_multi管理 博客分类: 数据库 mysql读写分离
-
分享我的开源项目-spring+mybatis实现读写分离 企业应用Spring读写分离
-
Mysql 实现主备同步 replication 功能 实现读写分离 博客分类: mysql读写分离DB mysql读写分离
-
mysql+spring+mybatis实现数据库读写分离的代码配置