如何解决使用Docker-compose进行MySQL主从配置
好的,所以我想为PHP运行在Nginx中托管的网站制作MysqL的主从复制。我已经设法连接到主MysqL,但是,我的从属容器似乎出现了一些错误。我想知道是否有什么问题或应该添加什么才能解决此问题。
You need to specify one of MysqL_ROOT_PASSWORD,MysqL_ALLOW_EMPTY_PASSWORD and MysqL_RANDOM_ROOT_PASSWORD
2020-10-15 09:09:44+00:00 [Note] [Entrypoint]: Entrypoint script for MysqL Server 1:10.5.6+maria~focal started.
2020-10-15 09:09:45+00:00 [Note] [Entrypoint]: Switching to dedicated user 'MysqL'
2020-10-15 09:09:45+00:00 [Note] [Entrypoint]: Entrypoint script for MysqL Server 1:10.5.6+maria~focal started.
2020-10-15 09:09:45+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
You need to specify one of MysqL_ROOT_PASSWORD,MysqL_ALLOW_EMPTY_PASSWORD and MysqL_RANDOM_ROOT_PASSWORD
我的docker-compose.yml文件
version: "3.3"
services:
MysqL:
image: mariadb:latest
restart: always
ports:
- "3306"
environment:
MysqL_REPLICATION_MODE: master
MysqL_REPLICATION_USER: repl_user
MysqL_REPLICATION_PASSWORD: repl_password
MysqL_ROOT_PASSWORD: rootpw
MysqL_DATABASE: database
MysqL_USER: user
MysqL_PASSWORD: mypw
networks:
- my-net
MysqL-slave:
image: mariadb:latest
restart: always
ports:
- "3306"
depends_on:
- MysqL
environment:
MysqL_REPLICATION_MODE: slave
MysqL_REPLICATION_USER: repl_user
MysqL_REPLICATION_PASSWORD: repl_password
MysqL_MASTER_HOST: MysqL
MysqL_MASTER_PORT_NUMBER: 3306
MysqL_MASTER_ROOT_PASSWORD: rootpw
MysqL_ROOT_PASSWORD: rootpw
networks:
- my-net
myPHP:
build: ./src/PHP
restart: always
expose:
- "9000"
volumes:
- ./src:/var/www/html
depends_on:
- MysqL
- MysqL-slave
networks:
- my-net
myNginx:
image: Nginx
restart: always
volumes:
- ./src/Nginx.ini:/etc/Nginx/conf.d/default.conf
- ./src/PHP-fpm.conf:/etc/PHP/7.4/fpm/PHP-fpm.conf
- ./src/www.conf:/etc/PHP/7.4/fpm/pool.d/www.conf
- ./src:/var/www/html/
ports:
- "8080:80"
depends_on:
- myPHP
networks:
- my-net
网络: 我的网: 司机:桥
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。