初识 Proxysql
1.ProxySQL 介绍和安装
ProxySQL 是一种高性能、高可用的开源中间件,适用于mysql和相关的数据库,如MariaDB
官网:http://www.proxysql.com
安装
发行版本下载链接:https://github.com/sysown/proxysql/releases
Ubuntu / Debian:
添加源
apt-get install -y lsb-release wget -O - 'http://repo.proxysql.com/ProxySQL/repo_pub_key' | apt-key add - echo deb http://repo.proxysql.com/ProxySQL/proxysql-1.4.x/$(lsb_release -sc)/ ./ \ | tee /etc/apt/sources.list.d/proxysql.list
安装:
apt-get update apt-get install proxysql OR apt-get install proxysql=version
Red Hat / CentOS:
添加源
cat <<EOF | tee /etc/yum.repos.d/proxysql.repo [proxysql_repo] name= ProxySQL YUM repository baseurl=http://repo.proxysql.com/ProxySQL/proxysql-1.4.x/centos/\$releasever gpgcheck= gpgkey=http://repo.proxysql.com/ProxySQL/repo_pub_key EOF
安装
yum install proxysql OR yum install proxysql-version
proxysql开启/关闭/重启
开启 service proxysql start 关闭 service proxysql stop 重启 service proxysql restart
管理员交互界面开启和关闭
进入管理界面 # mysql -u admin -padmin -h 127.0.0.1 -P6032 --prompt='Admin> ' 开启 Admin> proxysql start; Query OK, rows affected (0.00 sec) 关闭 Admin> proxysql stop; ERROR (HY000): Lost connection to MySQL server during query 重启 Admin> proxysql restart; ERROR (HY000): Lost connection to MySQL server during query
Proxysql 架构以及在线修改配置

Proxysql有三层架构,最底层是disk和config file,第二层是memory,最顶层是runtime
当第一次启动时,proxysql会抓取本地配置文件proxy.cnf并且加载至内存z中,并且最终加载到runtime生效,后续如果在线修改了配置后,需要load至runtime层使其生效,如果需要持久化保存,则需要save至磁盘即可
搭建一个最简单的Proxysql
预先安装好proxysql和mysql
proxysql按照上文安装方法就好
mysql安装:(https://www.cnblogs.com/wang-li/p/7726304.html)
进入proxysql管理界面
# mysql -u admin -padmin -h 127.0.0.1 -P6032 --prompt='Admin> ' mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection Server version: (ProxySQL Admin Module) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. Admin>
添加服务器的信息
Admin,); Query OK, row affected (0.00 sec)
将数据推到runtime和保存至本地磁盘
Admin> LOAD MYSQL SERVERS TO RUNTIME; Query OK, rows affected (0.00 sec) Admin> SAVE MYSQL SERVERS TO DISK; Query OK, rows affected (0.04 sec)
添加用户信息
Admin); Query OK, row affected (0.00 sec)
将数据推到runtime和保存至本地磁盘
Admin> LOAD MYSQL USERS TO RUNTIME; Query OK, rows affected (0.00 sec) Admin> save mysql users to disk; Query OK, rows affected (0.01 sec)
测试proxysql
# mysql -uroot -proot -h 127.0.0.1 -P6033 -e "SELECT @@port" mysql: [Warning] Using a password on the command line interface can be insecure. +--------+ | @@port | +--------+ | | +--------+ [root@MiWiFi-R3P-srv proxysql]#
初识 Proxysql的更多相关文章
- Android动画效果之初识Property Animation(属性动画)
前言: 前面两篇介绍了Android的Tween Animation(补间动画) Android动画效果之Tween Animation(补间动画).Frame Animation(逐帧动画)Andr ...
- 初识Hadoop
第一部分: 初识Hadoop 一. 谁说大象不能跳舞 业务数据越来越多,用关系型数据库来存储和处理数据越来越感觉吃力,一个查询或者一个导出,要执行很长 ...
- python学习笔记(基础四:模块初识、pyc和PyCodeObject是什么)
一.模块初识(一) 模块,也叫库.库有标准库第三方库. 注意事项:文件名不能和导入的模块名相同 1. sys模块 import sys print(sys.path) #打印环境变量 print(sy ...
- 初识IOS,Label控件的应用。
初识IOS,Label控件的应用. // // ViewController.m // Gua.test // // Created by 郭美男 on 16/5/31. // Copyright © ...
- UI篇(初识君面)
我们的APP要想吸引用户,就要把UI(脸蛋)搞漂亮一点.毕竟好的外貌是增进人际关系的第一步,我们程序员看到一个APP时,第一眼就是看这个软件的功能,不去关心界面是否漂亮,看到好的程序会说"我 ...
- Python导出Excel为Lua/Json/Xml实例教程(一):初识Python
Python导出Excel为Lua/Json/Xml实例教程(一):初识Python 相关链接: Python导出Excel为Lua/Json/Xml实例教程(一):初识Python Python导出 ...
- 初识SpringMvc
初识SpringMvc springMvc简介:SpringMVC也叫Spring Web mvc,属于表现层的框架.Spring MVC是Spring框架的一部分,是在Spring3.0后发布的 s ...
- 初识redis数据类型
初识redis数据类型 1.String(字符串) string是redis最基本的类型,一个key对应一个value. string类型是二进制安全的.意思是redis的string可以包含任何数据 ...
- Redis初识、设计思想与一些学习资源推荐
一.Redis简介 1.什么是Redis Redis 是一个开源的使用ANSI C 语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value 数据库,并提供多种语言的API.从2010 年 ...
随机推荐
- 2018/12/22:centos中转换目录时/root的影响
今天在将一个压缩包复制到/root下,并解压.从表面看我试在根目录下,但是就是不能进入生成的目录,提示no such file or diraction.最后我加上/root又好了,奇怪 编译环境:输 ...
- java script简介
JavaScript一种直译式脚本语言,是一种动态类型.弱类型.基于原型的语言,内置支持类型.它的解释器被称为JavaScript引擎,为浏览器的一部分,广泛用于客户端的脚本语言,最早是在HTML(标 ...
- IIS的UrlRewrite模块
以前在webform中重写URL是在Global.asax中的Addplication_BeginRequest事件中写代码进行跳转 今天介绍使用IIS提供的UrlRewrite模块实现URL重写 首 ...
- centos7 安装mongodb
1. 创建mongodb数据,日志,配置文件存放目录# mkdir /data# tar xzf mongodb-linux-x86_64-rhel70-4.0.8.tgz# mv mongodb- ...
- mysql学习笔记--数据库视图
一.视图 1. 概念 a. 视图是一张虚拟表,它表示一张表的部分或多张表的综合的结构 b. 视图仅仅是表结构,没有数据.视图的结构和数据建立在表的基础上 2. 创建视图 a. 语法: create [ ...
- leetcode 字谜
242. Valid Anagram Easy 66298FavoriteShare Given two strings s and t , write a function to determine ...
- SQL Server数据库中的系统数据库?
SQL Server的系统数据库分为:master,model,msdb和tempdb 1.Master数据库 Master数据库记录SQL Server系统的所有系统级别信息(表sysobjects ...
- Entity Framework 6源码学习--设置调试EF环境
下载源代码 打开https://github.com/aspnet/EntityFramework6下载源代码. 建立调试解决方案 建立一个EntityFramework.Sample.sln在Ent ...
- 4-19 css属性
1. margin 简写属性在一个声明中设置所有外边距属性.该属性可以有 1 到 4 个值. 说明 这个简写属性设置一个元素所有外边距的宽度,或者设置各边上外边距的宽度. 块级元素的垂直相邻外边距会合 ...
- linux下ping命令出现ping: sendto: Network is unreachable
问题:ping外网出现: sendto: Network is unreachable 查看: #route Route命令 : 在数据包没有有效传递的情况下,可以利用route命令查看路由表 [ro ...