mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
no more separate compose files for materialize mysql
This commit is contained in:
parent
178d3fdba0
commit
e4b3511d28
@ -1,10 +0,0 @@
|
||||
version: '2.3'
|
||||
services:
|
||||
mysql1:
|
||||
image: mysql:5.7
|
||||
restart: 'no'
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: clickhouse
|
||||
ports:
|
||||
- 3308:3306
|
||||
command: --server_id=100 --log-bin='mysql-bin-1.log' --default-time-zone='+3:00' --gtid-mode="ON" --enforce-gtid-consistency
|
@ -1,10 +1,10 @@
|
||||
version: '2.3'
|
||||
services:
|
||||
mysql8_0:
|
||||
mysql80:
|
||||
image: mysql:8.0
|
||||
restart: 'no'
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: clickhouse
|
||||
ports:
|
||||
- 33308:3306
|
||||
- ${MYSQL8_EXTERNAL_PORT}:${MYSQL8_INTERNAL_PORT}
|
||||
command: --server_id=100 --log-bin='mysql-bin-1.log' --default_authentication_plugin='mysql_native_password' --default-time-zone='+3:00' --gtid-mode="ON" --enforce-gtid-consistency
|
@ -5,7 +5,7 @@
|
||||
<source>
|
||||
<mysql >
|
||||
<db>test</db>
|
||||
<host>mysql1</host>
|
||||
<host>mysql57</host>
|
||||
<port>3306</port>
|
||||
<user>root</user>
|
||||
<password>clickhouse</password>
|
||||
@ -41,7 +41,7 @@
|
||||
<source>
|
||||
<mysql >
|
||||
<db>test</db>
|
||||
<host>mysql1</host>
|
||||
<host>mysql57</host>
|
||||
<port>3306</port>
|
||||
<user>root</user>
|
||||
<password>clickhouse</password>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<source>
|
||||
<mysql >
|
||||
<db>test</db>
|
||||
<host>mysql1</host>
|
||||
<host>mysql57</host>
|
||||
<port>3306</port>
|
||||
<user>root</user>
|
||||
<password>clickhouse</password>
|
||||
@ -42,7 +42,7 @@
|
||||
<source>
|
||||
<mysql >
|
||||
<db>test</db>
|
||||
<host>mysql1</host>
|
||||
<host>mysql57</host>
|
||||
<port>3306</port>
|
||||
<user>root</user>
|
||||
<password>clickhouse</password>
|
||||
@ -78,7 +78,7 @@
|
||||
<source>
|
||||
<mysql >
|
||||
<db>test</db>
|
||||
<host>mysql1</host>
|
||||
<host>mysql57</host>
|
||||
<port>3306</port>
|
||||
<user>root</user>
|
||||
<password>clickhouse</password>
|
||||
|
@ -2,6 +2,8 @@
|
||||
import pymysql.cursors
|
||||
import pytest
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
import time
|
||||
import logging
|
||||
|
||||
CONFIG_FILES = ['configs/dictionaries/mysql_dict1.xml', 'configs/dictionaries/mysql_dict2.xml',
|
||||
'configs/remote_servers.xml']
|
||||
@ -87,11 +89,22 @@ def prepare_mysql_table(table_name, index):
|
||||
# Create CH Dictionary tables based on MySQL tables
|
||||
query(create_clickhouse_dictionary_table_template.format(table_name + str(index), 'dict' + str(index)))
|
||||
|
||||
|
||||
def get_mysql_conn():
|
||||
conn = pymysql.connect(user='root', password='clickhouse', host='127.0.0.10', port=cluster.mysql_port)
|
||||
return conn
|
||||
|
||||
errors = []
|
||||
conn = None
|
||||
for _ in range(5):
|
||||
try:
|
||||
if conn is None:
|
||||
conn = pymysql.connect(user='root', password='clickhouse', host='127.0.0.1', port=cluster.mysql_port)
|
||||
else:
|
||||
conn.ping(reconnect=True)
|
||||
logging.debug("MySQL Connection establised: 127.0.0.1:{}".format(cluster.mysql_port))
|
||||
return conn
|
||||
except Exception as e:
|
||||
errors += [str(e)]
|
||||
time.sleep(1)
|
||||
|
||||
raise Exception("Connection not establised, {}".format(errors))
|
||||
|
||||
def create_mysql_table(conn, table_name):
|
||||
with conn.cursor() as cursor:
|
||||
|
Loading…
Reference in New Issue
Block a user