clickhouse ProxySQL

运行环境:

Clickhouse ProxySQL 概述:

 

软件下载安装:

#wget https://github.com/sysown/proxysql/releases/download/v2.0.12/proxysql-2.0.12-1-clickhouse-centos7.x86_64.rpm

yum -y localinstall proxysql-2.0.12-1-clickhouse-centos7.x86_64.rpm 


相关的配置:
# rpm -ql proxysql-2.0.12-1
/etc/logrotate.d/proxysql
/etc/proxysql.cnf
/etc/systemd/system/proxysql-initial.service
/etc/systemd/system/proxysql.service
/usr/bin/proxysql
/usr/share/proxysql/tools/proxysql_galera_checker.sh
/usr/share/proxysql/tools/proxysql_galera_writer.pl

默认的配置文件:


启动clickhouse协议:

# proxysql --clickhouse-server
2020-07-12 19:24:13 [INFO] Using config file /etc/proxysql.cnf
2020-07-12 19:24:13 main.cpp:1610:main(): [ERROR] Current RLIMIT_NOFILE is very low: 1024 .  Tune RLIMIT_NOFILE correctly before running ProxySQL
2020-07-12 19:24:13 main.cpp:1617:main(): [WARNING] Automatically setting RLIMIT_NOFILE to 4096
2020-07-12 19:24:13 [INFO] Using OpenSSL version: OpenSSL 1.1.1d  10 Sep 2019
2020-07-12 19:24:13 [INFO] SSL keys/certificates found in datadir (/var/lib/proxysql): loading them.
Daemon already running on PID file 9155
# ProxySQL默认会以daemon的方式在后台


登陆:

[root@hadoop ~]# mysql -h192.168.8.110 -uadmin -padmin -P6032
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1040 (42000): User 'admin' can only connect locally
[root@hadoop ~]# mysql -h127.0.0.1 -uadmin -padmin -P6032             
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 id is 2
Server version: 5.5.30 (ProxySQL Admin Module)

Copyright (c) 2000, 2020, 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。ProxySQL端口是6032


创建表:
mysql> CREATE TABLE clickhouse_users (
    ->     username VARCHAR NOT NULL,
    ->     password VARCHAR,
    ->     active INT CHECK (active IN (0,1)) NOT NULL DEFAULT 1,
    ->     max_connections INT CHECK (max_connections >=0) NOT NULL DEFAULT 10000,
    ->     PRIMARY KEY (username));
Query OK, 0 rows affected (0.01 sec)


启动和配置:

 

功能介绍:

 

参考:

https://proxysql.com/blog/clickhouse-and-proxysql-queries-rewrite/

https://proxysql.com/documentation/clickhouse-configuration/

https://www.altinity.com/blog/2018/7/13/clickhouse-and-proxysql-queries-rewrite

https://github.com/sysown/proxysql/wiki/ClickHouse-Support

你可能感兴趣的:(Clickhouse)