Merge pull request #283 from nacos-group/pader-fix-mysql-patch

Optimize mysql script incompatibility issues.
This commit is contained in:
paderlol 2022-09-29 17:29:20 +08:00 committed by GitHub
commit 6cff3b6906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 85 additions and 32 deletions

View File

@ -6,3 +6,4 @@ MYSQL_SERVICE_DB_NAME=nacos_devtest
MYSQL_SERVICE_PORT=3306 MYSQL_SERVICE_PORT=3306
MYSQL_SERVICE_USER=nacos MYSQL_SERVICE_USER=nacos
MYSQL_SERVICE_PASSWORD=nacos MYSQL_SERVICE_PASSWORD=nacos
MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true

1
env/nacos-ip.env vendored
View File

@ -5,3 +5,4 @@ MYSQL_SERVICE_DB_NAME=nacos_devtest
MYSQL_SERVICE_PORT=3306 MYSQL_SERVICE_PORT=3306
MYSQL_SERVICE_USER=nacos MYSQL_SERVICE_USER=nacos
MYSQL_SERVICE_PASSWORD=nacos MYSQL_SERVICE_PASSWORD=nacos
MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true

View File

@ -6,4 +6,4 @@ MYSQL_SERVICE_DB_NAME=nacos_devtest
MYSQL_SERVICE_PORT=3306 MYSQL_SERVICE_PORT=3306
MYSQL_SERVICE_USER=nacos MYSQL_SERVICE_USER=nacos
MYSQL_SERVICE_PASSWORD=nacos MYSQL_SERVICE_PASSWORD=nacos
MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true

View File

@ -6,7 +6,6 @@ services:
image: nacos/nacos-server:${NACOS_VERSION} image: nacos/nacos-server:${NACOS_VERSION}
volumes: volumes:
- ./cluster-logs/nacos1:/home/nacos/logs - ./cluster-logs/nacos1:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports: ports:
- "8848:8848" - "8848:8848"
- "9848:9848" - "9848:9848"
@ -21,7 +20,6 @@ services:
container_name: nacos2 container_name: nacos2
volumes: volumes:
- ./cluster-logs/nacos2:/home/nacos/logs - ./cluster-logs/nacos2:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports: ports:
- "8849:8848" - "8849:8848"
- "9849:9848" - "9849:9848"
@ -34,7 +32,6 @@ services:
container_name: nacos3 container_name: nacos3
volumes: volumes:
- ./cluster-logs/nacos3:/home/nacos/logs - ./cluster-logs/nacos3:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports: ports:
- "8850:8848" - "8850:8848"
- "9850:9848" - "9850:9848"

View File

@ -1,4 +1,4 @@
version: "3" version: "3.8"
services: services:
nacos1: nacos1:
hostname: nacos1 hostname: nacos1
@ -6,7 +6,6 @@ services:
image: nacos/nacos-server:${NACOS_VERSION} image: nacos/nacos-server:${NACOS_VERSION}
volumes: volumes:
- ./cluster-logs/nacos1:/home/nacos/logs - ./cluster-logs/nacos1:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports: ports:
- "8848:8848" - "8848:8848"
- "9848:9848" - "9848:9848"
@ -15,7 +14,8 @@ services:
- ../env/nacos-hostname.env - ../env/nacos-hostname.env
restart: always restart: always
depends_on: depends_on:
- mysql mysql:
condition: service_healthy
nacos2: nacos2:
hostname: nacos2 hostname: nacos2
@ -23,7 +23,6 @@ services:
container_name: nacos2 container_name: nacos2
volumes: volumes:
- ./cluster-logs/nacos2:/home/nacos/logs - ./cluster-logs/nacos2:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports: ports:
- "8849:8848" - "8849:8848"
- "9849:9848" - "9849:9848"
@ -31,14 +30,14 @@ services:
- ../env/nacos-hostname.env - ../env/nacos-hostname.env
restart: always restart: always
depends_on: depends_on:
- mysql mysql:
condition: service_healthy
nacos3: nacos3:
hostname: nacos3 hostname: nacos3
image: nacos/nacos-server:${NACOS_VERSION} image: nacos/nacos-server:${NACOS_VERSION}
container_name: nacos3 container_name: nacos3
volumes: volumes:
- ./cluster-logs/nacos3:/home/nacos/logs - ./cluster-logs/nacos3:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports: ports:
- "8850:8848" - "8850:8848"
- "9850:9848" - "9850:9848"
@ -46,14 +45,25 @@ services:
- ../env/nacos-hostname.env - ../env/nacos-hostname.env
restart: always restart: always
depends_on: depends_on:
- mysql mysql:
condition: service_healthy
mysql: mysql:
container_name: mysql container_name: mysql
image: nacos/nacos-mysql:5.7 build:
context: .
dockerfile: ./image/mysql/5.7/Dockerfile
tags:
- "example/mysql:5.7"
image: example/mysql:5.7
env_file: env_file:
- ../env/mysql.env - ../env/mysql.env
volumes: volumes:
- ./mysql:/var/lib/mysql - ./mysql:/var/lib/mysql
ports: ports:
- "3306:3306" - "3306:3306"
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
interval: 5s
timeout: 10s
retries: 10

View File

@ -1,4 +1,4 @@
version: "2" version: "3.8"
services: services:
nacos1: nacos1:
image: nacos/nacos-server:${NACOS_VERSION} image: nacos/nacos-server:${NACOS_VERSION}
@ -16,7 +16,8 @@ services:
- ../env/nacos-ip.env - ../env/nacos-ip.env
restart: on-failure restart: on-failure
depends_on: depends_on:
- mysql mysql:
condition: service_healthy
nacos2: nacos2:
image: nacos/nacos-server:${NACOS_VERSION} image: nacos/nacos-server:${NACOS_VERSION}
@ -33,7 +34,8 @@ services:
- ../env/nacos-ip.env - ../env/nacos-ip.env
restart: always restart: always
depends_on: depends_on:
- mysql mysql:
condition: service_healthy
nacos3: nacos3:
image: nacos/nacos-server:${NACOS_VERSION} image: nacos/nacos-server:${NACOS_VERSION}
container_name: nacos3 container_name: nacos3
@ -49,10 +51,16 @@ services:
- ../env/nacos-ip.env - ../env/nacos-ip.env
restart: always restart: always
depends_on: depends_on:
- mysql mysql:
condition: service_healthy
mysql: mysql:
container_name: mysql container_name: mysql
image: nacos/nacos-mysql:5.7 build:
context: .
dockerfile: ./image/mysql/5.7/Dockerfile
tags:
- "example/mysql:5.7"
image: example/mysql:5.7
networks: networks:
nacos_net: nacos_net:
ipv4_address: 172.16.238.13 ipv4_address: 172.16.238.13
@ -62,6 +70,11 @@ services:
- ./mysql:/var/lib/mysql - ./mysql:/var/lib/mysql
ports: ports:
- "3306:3306" - "3306:3306"
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
interval: 5s
timeout: 10s
retries: 10
networks: networks:
nacos_net: nacos_net:
driver: bridge driver: bridge

View File

@ -0,0 +1,5 @@
FROM mysql:5.7.39
ADD https://raw.githubusercontent.com/alibaba/nacos/develop/distribution/conf/mysql-schema.sql /docker-entrypoint-initdb.d/nacos-mysql.sql
RUN chown -R mysql:mysql /docker-entrypoint-initdb.d/nacos-mysql.sql
EXPOSE 3306
CMD ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]

View File

@ -0,0 +1,5 @@
FROM mysql:8.0.30
ADD https://raw.githubusercontent.com/alibaba/nacos/develop/distribution/conf/mysql-schema.sql /docker-entrypoint-initdb.d/nacos-mysql.sql
RUN chown -R mysql:mysql /docker-entrypoint-initdb.d/nacos-mysql.sql
EXPOSE 3306
CMD ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]

View File

@ -8,7 +8,6 @@ services:
- MODE=standalone - MODE=standalone
volumes: volumes:
- ./standalone-logs/:/home/nacos/logs - ./standalone-logs/:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports: ports:
- "8848:8848" - "8848:8848"
- "9848:9848" - "9848:9848"

View File

@ -1,4 +1,4 @@
version: "2" version: "3.8"
services: services:
nacos: nacos:
image: nacos/nacos-server:${NACOS_VERSION} image: nacos/nacos-server:${NACOS_VERSION}
@ -13,17 +13,29 @@ services:
- "9848:9848" - "9848:9848"
- "9555:9555" - "9555:9555"
depends_on: depends_on:
- mysql mysql:
condition: service_healthy
restart: on-failure restart: on-failure
mysql: mysql:
container_name: mysql container_name: mysql
image: nacos/nacos-mysql:5.7 build:
context: .
dockerfile: ./image/mysql/5.7/Dockerfile
tags:
- "example/mysql:5.7"
image: example/mysql:5.7
env_file: env_file:
- ../env/mysql.env - ../env/mysql.env
volumes: volumes:
- ./mysql:/var/lib/mysql - ./mysql:/var/lib/mysql
ports: ports:
- "3306:3306" - "3306:3306"
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
interval: 5s
timeout: 10s
retries: 10
# prometheus: # prometheus:
# container_name: prometheus # container_name: prometheus
# image: prom/prometheus:latest # image: prom/prometheus:latest

View File

@ -1,4 +1,4 @@
version: "2" version: "3.8"
services: services:
nacos: nacos:
image: nacos/nacos-server:${NACOS_VERSION} image: nacos/nacos-server:${NACOS_VERSION}
@ -7,22 +7,32 @@ services:
- ../env/nacos-standlone-mysql.env - ../env/nacos-standlone-mysql.env
volumes: volumes:
- ./standalone-logs/:/home/nacos/logs - ./standalone-logs/:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports: ports:
- "8848:8848" - "8848:8848"
- "9848:9848" - "9848:9848"
- "9555:9555" - "9555:9555"
depends_on: depends_on:
- mysql mysql:
condition: service_healthy
restart: always restart: always
mysql: mysql:
container_name: mysql container_name: mysql
image: nacos/nacos-mysql:8.0.16 build:
context: .
dockerfile: ./image/mysql/8/Dockerfile
tags:
- "example/mysql:8.0.30"
image: example/mysql:8.0.30
env_file: env_file:
- ../env/mysql.env - ../env/mysql.env
volumes: volumes:
- ./mysql:/var/lib/mysql - ./mysql:/var/lib/mysql
ports: ports:
- "3306:3306" - "3306:3306"
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
interval: 5s
timeout: 10s
retries: 10