mysql实现读写方式有几种方式有几下几种:
proxySQL是一款可以实际用于生产环境的MySQL中间件,它有官方版和percona版两种。
percona版是官方版的基础上修改的,虽然也是一个轻量级别产品,但性能很好(据测试,能处理千亿级的数据),功能也足够,能够满足中间件中间件所需的绝大多数功能,包括:
//配置yum源
# cat <<EOF | tee /etc/yum.repos.d/proxysql.repo
[proxysql_repo] name= ProxySQL
baseurl=http://repo.proxysql.com/ProxySQL/proxysql-1.4.x/centos/7
gpgcheck=1
gpgkey=http://repo.proxysql.com/ProxySQL/repo_pub_key
EOF
# yum -y install proxysql
警告:这种安装方式wifi上不能下载,需要手机流量下载
proxyslq下载地址:https://files.cnblogs.com/files/liuzhijun666/proxysql.rar
# rz 上传
# rpm -ivh proxysql-1.4.8-1-centos7.x86_64.rpm --nodeps
# systemctl restart proxysql
# yum install -y mariadb
# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:6032 *:*
LISTEN 0 128 *:6033 *:*
LISTEN 0 128 *:6033 *:*
LISTEN 0 128 *:6033 *:*
LISTEN 0 128 *:6033 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25
# mysql -uadmin -padmin -h127.0.0.1 -P6032 //admin为管理账号(仅限本机)
mysql> show databases;
+-----+---------------+-------------------------------------+
| seq | name | file |
+-----+---------------+-------------------------------------+
| 0 | main | |
| 2 | disk | /var/lib/proxysql/proxysql.db |
| 3 | stats | |
| 4 | monitor | |
| 5 | stats_history | /var/lib/proxysql/proxysql_stats.db |
+-----+---------------+-------------------------------------+
5 rows in set (0.01 sec)
后续操作请见mysql类的内容
原文:https://www.cnblogs.com/liuzhijun666/p/13170574.html