问题描述
我正在用这个 github repository 研究我的项目。在开始之前,我的环境是 Debian Linux (i386)。如果您想自己启动,请按照以下流程操作:
- 克隆这个仓库
- 根存储库中的命令
make
- 访问https://lusehair.42.fr。还可以访问 https://lusehair.42.fr/wp-admin 并更改一些帖子。
(密码在42inception/srcs/.env
中) -
docker-compose down
在另一个终端
(你必须在42inception/srcs
文件夹中) -
sudo systemctl mariadb MysqL Nginx
(您也可以使用service
命令执行此操作) - 如果关闭 docker-compose 是完美的,请通过
docker-compose up --build
或make reload
重新启动。 - 也许你会看到错误...
我删除了配置文件中的 log_error
选项,并检查了错误日志。
就是这样:
mariadb_1 | 2021-06-30 10:03:24 0 [ERROR] Can't start server : Bind on unix socket: No such file or directory
mariadb_1 | 2021-06-30 10:03:24 0 [ERROR] Do you already have another MysqLd server running on socket: /run/MysqLd/MysqLd.sock ?
mariadb_1 | 2021-06-30 10:03:24 0 [ERROR] Aborting
mariadb_1 |
srcs_mariadb_1 exited with code 1
问题是当我第一次尝试时,这个项目运行得很好。
#docker-compose.yml
version: '3'
services:
mariadb:
image: mariadb:inc
volumes:
- ~/data/maria:/var/lib/MysqL
restart: always
environment:
MARIA_LOGIN: "${MARIA_LOGIN}"
MARIA_PASS: "${MARIA_PASS}"
ports:
- "3306:3306"
build:
context: ./requirements/mariadb
dockerfile: Dockerfile
networks:
vpcbr:
env_file: .env
wordpress:
depends_on:
- mariadb
image: wordpress:inc
volumes:
- ~/data/wp:/var/www/wordpress
restart: always
environment:
WP_LOGIN: "${WP_LOGIN}"
WP_PASS: "${WP_PASS}"
WPU_1LOGIN: "${WPU_1LOGIN}"
WPU_1PASS: "${WPU_1PASS}"
MARIA_LOGIN: "${MARIA_LOGIN}"
MARIA_PASS: "${MARIA_PASS}"
ports:
- "9000:9000"
build:
context: ./requirements/wordpress
dockerfile: Dockerfile
networks:
vpcbr:
env_file: .env
Nginx:
image: Nginx:inc
restart: always
depends_on:
- wordpress
ports:
- "443:443"
volumes:
- ~/data/wp:/var/www/wordpress
build:
context: ./requirements/Nginx
dockerfile: Dockerfile
networks:
vpcbr:
extra_hosts:
- "lusehair.42.fr:127.0.0.1"
env_file: .env
networks:
vpcbr:
driver: bridge
#mariadb Dockerfile
FROM debian:buster
MAINTAINER lusehair <lusehair@42.student.fr>
RUN apt-get update
RUN apt-get install -y mariadb-server vim procps;
copY tools/setup.sh .
RUN chmod +x setup.sh
EXPOSE 3306
RUN rm /etc/MysqL/mariadb.conf.d/50-server.cnf
# Swith off the bind address
copY tools/50-server.cnf /etc/MysqL/mariadb.conf.d
ENTRYPOINT ["sh","/setup.sh"]
#mariadb setup.sh
if [ ! -d "/var/lib/MysqL/wordpress" ]; then
MysqL_install_db
service MysqL start
MysqL -e "CREATE USER '${MARIA_LOGIN}'@'localhost' identified by '${MARIA_PASS}';" &&\
MysqL -e "CREATE DATABASE IF NOT EXISTS wordpress;" &&\
MysqL -e "GRANT ALL PRIVILEGES ON *.* TO '${MARIA_LOGIN}'@'%' IDENTIFIED BY '${MARIA_PASS}';" &&\
MysqL -e "FLUSH PRIVILEGES;"
service MysqL stop
fi
#sleep 5
MysqLd
# mariadb 50-server.cnf
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/MysqL
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the MysqLd standalone daemon
[MysqLd]
#
# * Basic Settings
#
user = MysqL
pid-file = /run/MysqLd/MysqLd.pid
socket = /run/MysqLd/MysqLd.sock
#port = 3306
basedir = /usr
datadir = /var/lib/MysqL
tmpdir = /tmp
lc-messages-dir = /usr/share/MysqL
#skip-external-locking
# Instead of skip-networking the default is Now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
#
# * Fine Tuning
#
#key_buffer_size = 16M
#max_allowed_packet = 16M
#thread_stack = 192K
#thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
#myisam_recover_options = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
#query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/MysqL/MysqL.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/MysqL/error.log
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log_file = /var/log/MysqL/mariadb-slow.log
#long_query_time = 10
#log_slow_rate_limit = 1000
#log_slow_verbosity = query_plan
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave,see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/MysqL/MysqL-bin.log
expire_logs_days = 10
#max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = exclude_database_name
#
# * Security Features
#
# Read the manual,too,if you want chroot!
#chroot = /var/lib/MysqL/
#
# For generating SSL certificates you can use for example the GUI tool "tinyca".
#
#ssl-ca = /etc/MysqL/cacert.pem
#ssl-cert = /etc/MysqL/server-cert.pem
#ssl-key = /etc/MysqL/server-key.pem
#
# Accept only connections using the latest and most secure TLS protocol version.
# ..when MariaDB is compiled with OpenSSL:
#ssl-cipher = TLSv1.2
# ..when MariaDB is compiled with YaSSL (default in Debian):
#ssl = on
#
# * Character sets
#
# MysqL/MariaDB default is latin1,but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
#
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/MysqL/.
# Read the manual for more InnoDB related options. There are many!
#
# * Unix socket authentication plugin is built-in since 10.0.22-6
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
# this is only for embedded server
[embedded]
# This group is only read by MariaDB servers,not by MysqL.
# If you use the same .cnf file for MysqL and MariaDB,# you can put MariaDB-only options here
[mariadb]
# This group is only read by MariaDB-10.3 servers.
# If you use the same .cnf file for MariaDB of different versions,# use this group for options that older servers don't understand
[mariadb-10.3]
我尝试过的事情:
- 从
log_error
中删除50-server.cnf
以检查错误 - 将
socket = /run/MysqLd/MysqLd.sock
更改为socket = /run/MysqLd/MysqL.sock
(我看到了这个 here)
问:有人说 MysqLd.sock 在/var/lib/MysqL/
中,另一个说/tmp/
但我的东西是/run/MysqLd/
。什么是正确的? - 尝试更改
setup.sh
的结构。该项目在第一次尝试时有效,所以我认为重新启动某些东西有问题,并尝试了一些东西。 (制作目录、ln -s MysqLd 文件等)但它们都不起作用。
我认为问题是由 setup.sh
或 50-server.cnf
引起的。但我不完全了解这些结构。我找不到答案。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)