add proxysql
parent
1934044708
commit
c5ec29c153
|
@ -0,0 +1,150 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: proxysql-conf
|
||||
data:
|
||||
config: |-
|
||||
datadir="/var/lib/proxysql"
|
||||
|
||||
admin_variables=
|
||||
{
|
||||
admin_credentials="admin:admin;radmin:radmin"
|
||||
mysql_ifaces="0.0.0.0:3306"
|
||||
}
|
||||
mysql_variables=
|
||||
{
|
||||
threads=2
|
||||
max_connections=2048
|
||||
default_query_delay=0
|
||||
default_query_timeout=36000000
|
||||
have_compress=true
|
||||
poll_timeout=2000
|
||||
interfaces="0.0.0.0:3303"
|
||||
default_schema="information_schema"
|
||||
stacksize=1048576
|
||||
server_version="8.0.33"
|
||||
connect_timeout_server=3000
|
||||
monitor_username="monitor"
|
||||
monitor_password="monitor"
|
||||
monitor_history=600000
|
||||
monitor_connect_interval=5000
|
||||
monitor_ping_interval=2000
|
||||
monitor_read_only_interval=1500
|
||||
monitor_read_only_timeout=500
|
||||
ping_interval_server_msec=15000
|
||||
ping_timeout_server=500
|
||||
commands_stats=true
|
||||
sessions_sort=true
|
||||
connect_retries_on_failure=10
|
||||
}
|
||||
# defines all the MySQL servers
|
||||
mysql_servers =
|
||||
(
|
||||
{ address="mysql-m.base.svc.cluster.local" , port=3306 , hostgroup=1, max_connections=5000 },
|
||||
{ address="mysql-s.base.svc.cluster.local" , port=3306 , hostgroup=1, max_connections=5000 },
|
||||
)
|
||||
# defines all the MySQL users
|
||||
mysql_users:
|
||||
(
|
||||
{ username = "root" , password = "Beaconfire@2099" , default_hostgroup = 0 , active = 1 }
|
||||
)
|
||||
# defines all the MySQL rules
|
||||
mysql_query_rules:
|
||||
(
|
||||
{
|
||||
rule_id=1
|
||||
active=1
|
||||
match_pattern="^SELECT .* FOR UPDATE$"
|
||||
destination_hostgroup=0
|
||||
apply=1
|
||||
},
|
||||
{
|
||||
rule_id=2
|
||||
active=1
|
||||
match_pattern="^SELECT"
|
||||
destination_hostgroup=1
|
||||
apply=1
|
||||
}
|
||||
)
|
||||
scheduler=
|
||||
(
|
||||
)
|
||||
mysql_replication_hostgroups=
|
||||
(
|
||||
{
|
||||
writer_hostgroup=0
|
||||
reader_hostgroup=1
|
||||
comment="Proxy Server BFS-DB1"
|
||||
}
|
||||
)
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: proxysql
|
||||
spec:
|
||||
replicas: 1
|
||||
serviceName: proxysql
|
||||
selector:
|
||||
matchLabels:
|
||||
app: proxysql
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: proxysql
|
||||
spec:
|
||||
containers:
|
||||
- name: proxysql
|
||||
image: proxysql/proxysql:2.6.2
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/proxysql
|
||||
- name: conf
|
||||
mountPath: /etc/proxysql.cnf
|
||||
subPath: proxysql.cnf
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: data
|
||||
hostPath:
|
||||
path: /data/prod/proxysql
|
||||
- name: conf
|
||||
configMap:
|
||||
name: proxysql-conf
|
||||
items:
|
||||
- key: config
|
||||
path: proxysql.cnf
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: "app.kubernetes.io/component"
|
||||
operator: In
|
||||
values:
|
||||
- mysql
|
||||
tolerations:
|
||||
- key: "app.kubernetes.io/component"
|
||||
operator: "Equal"
|
||||
value: "mysql"
|
||||
effect: "NoSchedule"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: proxysql
|
||||
labels:
|
||||
app: proxysql
|
||||
spec:
|
||||
ports:
|
||||
- name: proxysql-srv
|
||||
protocol: TCP
|
||||
port: 3306
|
||||
targetPort: 3306
|
||||
- name: proxysql-mgmt
|
||||
protocol: TCP
|
||||
port: 3303
|
||||
targetPort: 3303
|
||||
selector:
|
||||
app: proxysql
|
||||
type: ClusterIP
|
Loading…
Reference in New Issue