Gibbon Pagekit机房登陆不上

尝试了很多版本的mysql镜像,都存在这样那样的的问题。原始需求中,需要同时支持x86_64(AMD64)和aarch64(ARM64V8),最后找到Oracle官方出品的MySQL-Server 8.0镜像包,作为基础镜像包,并在其基础上做一些定制。当然还存在一些问题,比如my.cnf通过configmap定制等等,后续慢慢优化补充。
1. 构建镜像
1.1 重写 my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
secure-file-priv=/var/lib/mysql-files
user=mysql
pid-file=/var/run/mysqld/mysqld.pid
gtid_mode=ON
enforce_gtid_consistency=ON
skip-host-cache
skip-name-resolve
authentication_policy=mysql_native_password
binlog_cache_size=1M
binlog_format=row
binlog_expire_logs_seconds=2592000
replica_skip_errors=1062

!includedir /etc/my.cnf.d/
1234567891011121314151617
1.2 重写 entrypoint.sh
为避免覆盖原始启动文件,将其Pagekit一份,命名为docker-entrypoint.sh
#!/bin/bash
# Copyright (c) 2017, 2021, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
set -e

echo “[Entrypoint] MySQL Docker Image 8.0.28-1.2.7-server”
# Fetch value from server config
# We use mysqld –verbose –help instead of my_print_defaults because the
# latter only show values present in config files, and not server defaults
_get_config() {
local conf=”$1″; shift
“$@” –verbose –help 2>/dev/null | grep “^$conf” | awk ‘$1 == “‘”$conf”‘” { print $2; exit }’
}

# Generate a random password
_mkpw() {
letter=$(cat /dev/urandom| tr -dc a-zA-Z | dd bs=1 count=16 2> /dev/null )
number=$(cat /dev/urandom| tr -dc 0-9 | dd bs=1 count=8 2> /dev/null)
special=$(cat /dev/urandom| tr -dc ‘=+@#%^&*_.,;:?/’ | dd bs=1 count=8 2> /dev/null)

echo $letter$number$special | fold -w 1 | shuf | tr -d ‘\n’
}

# If command starts with an option, prepend mysqld
# This allows users to add command-line options without
# needing to specify the “mysqld” command
if [ “${1:0:1}” = ‘-‘ ]; then
set — mysqld “$@”
fi

# Check if entrypoint (and the container) is running as root
if [ $(id -u) = “0” ]; then
is_root=1
install_devnull=”install /dev/null -m0600 -omysql -gmysql”
MYSQLD_USER=mysql
else
install_devnull=”install /dev/null -m0600″
MYSQLD_USER=$(id -u)
fi

if [ “$1” = ‘mysqld’ ]; then
# Test that the server can start. We redirect stdout to /dev/null so
# only the error messages are left.
result=0
output=$(“$@” –validate-config) || result=$?
if [ ! “$result” = “0” ]; then
echo >&2 ‘[Entrypoint] ERROR: Unable to start MySQL. Please check your configuration.’
echo >&2 “[Entrypoint] $output”
exit 1
fi

# Get config
DATADIR=”$(_get_config ‘datadir’ “$@”)”
SOCKET=”$(_get_config ‘socket’ “$@”)”

if [ ! -d “$DATADIR/mysql” ]; then
# If the password variable is a filename we use the contents of the file. We
# read this first to make sure that a proper error is generated for empty files.
if [ -f “$MYSQL_ROOT_PASSWORD” ]; then
MYSQL_ROOT_PASSWORD=”$(cat $MYSQL_ROOT_PASSWORD)”
if [ -z “$MYSQL_ROOT_PASSWORD” ]; then
echo >&2 ‘[Entrypoint] Empty MYSQL_ROOT_PASSWORD file specified.’
exit 1
fi
fi
if [ -z “$MYSQL_ROOT_PASSWORD” -a -z “$MYSQL_ALLOW_EMPTY_PASSWORD” -a -z “$MYSQL_RANDOM_ROOT_PASSWORD” ]; then
echo >&2 ‘[Entrypoint] No password option specified for new database.’
echo >&2 ‘[Entrypoint] A random onetime password will be generated.’
MYSQL_RANDOM_ROOT_PASSWORD=true
MYSQL_ONETIME_PASSWORD=true
fi
if [ ! -d “$DATADIR” ]; then
mkdir -p “$DATADIR”
chown mysql:mysql “$DATADIR”
fi

#### [BEGIN] mysql-cluster ############################################################################
set -x
if [ ! -z “$MYSQL_REPL_USER” ]; then
if [[ ! $HOSTNAME =~ -([0-9]+)$ ]]; then
echo >&2 “[Entrypoint] Invalid mysql cluster hostname [$HOSTNAME]”
exit 1
fi

ordinal=${HOSTNAME: -1}

# it’s a slave node, the master node host is required
if [ “$ordinal” != “0” -a -z “$MYSQL_MASTER_HOST” ]; then
echo >&2 “[Entrypoint] No master node host option specified for a slave node: MYSQL_MASTER_HOST”
exit 1
fi

SERVER_ID=$((100 + $ordinal))

if [ “$ordinal” = “0” ]; then
cat > /etc/my.cnf.d/server-id.cnf < /etc/my.cnf.d/server-id.cnf </dev/null; then
break
fi
echo ‘[Entrypoint] Waiting for server…’
sleep 1
done
if [ “$i” = 0 ]; then
echo >&2 ‘[Entrypoint] Timeout during MySQL init.’
exit 1
fi

mysql_tzinfo_to_sql /usr/share/zoneinfo | “${mysql[@]}” mysql

if [ ! -z “$MYSQL_RANDOM_ROOT_PASSWORD” ]; then
MYSQL_ROOT_PASSWORD=”$(_mkpw)”
echo “[Entrypoint] GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD”
fi
if [ -z “$MYSQL_ROOT_HOST” ]; then
ROOTCREATE=”ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘${MYSQL_ROOT_PASSWORD}’;”
else
ROOTCREATE=”ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘${MYSQL_ROOT_PASSWORD}’; \
CREATE USER ‘root’@’${MYSQL_ROOT_HOST}’ IDENTIFIED BY ‘${MYSQL_ROOT_PASSWORD}’; \
GRANT ALL ON *.* TO ‘root’@’${MYSQL_ROOT_HOST}’ WITH GRANT OPTION ; \
GRANT PROXY ON ”@” TO ‘root’@’${MYSQL_ROOT_HOST}’ WITH GRANT OPTION ;”
fi
“${mysql[@]}” <<-EOSQL DELETE FROM mysql.user WHERE user NOT IN ('mysql.infoschema', 'mysql.session', 'mysql.sys', 'root') OR host NOT IN ('localhost'); CREATE USER 'healthchecker'@'localhost' IDENTIFIED BY 'healthcheckpass'; ${ROOTCREATE} FLUSH PRIVILEGES ; EOSQL if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then # Put the password into the temporary config file cat >“$PASSFILE” < “$SQL”
ALTER USER ‘root’@’${MYSQL_ROOT_HOST}’ PASSWORD EXPIRE;
ALTER USER ‘root’@’localhost’ PASSWORD EXPIRE;
EOF
else
cat << EOF > “$SQL”
ALTER USER ‘root’@’localhost’ PASSWORD EXPIRE;
EOF
fi
set — “$@” –init-file=”$SQL”
unset SQL
fi

echo
echo ‘[Entrypoint] MySQL init process done. Ready for start up.’
echo
fi

# Used by healthcheck to make sure it doesn’t mistakenly report container
# healthy during startup
# Put the password into the temporary config file
touch /var/lib/mysql-files/healthcheck.cnf
cat >”/var/lib/mysql-files/healthcheck.cnf” < mysql-namespace.yml < mysql-secret.yml < mysql-pv.yml < mysql-pvc.yml < mysql-headless-svc.yml < mysql-service.yml < create database testdb;
Query OK, 1 row affected (0.11 sec)

mysql> use testdb;
Database changed
mysql> create table emp(id int, name varchar(20));
Query OK, 0 rows affected (0.39 sec)

mysql> insert into emp values(1, ‘eli’);
Query OK, 1 row affected (0.06 sec)
12345678910111213141516171819202122232425
3.2 从节点读
$ kubectl exec -it mysql-2 -n mysql-cluster — /bin/bash
bash-4.4# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.28 MySQL Community Server – GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| sys |
| testdb |
+——————–+
5 rows in set (0.01 sec)

mysql> use testdb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+——————+
| Tables_in_testdb |
+——————+
| emp |
+——————+
1 row in set (0.00 sec)

mysql> select * from emp;
+——+——+
| id | name |
+——+——+
| 1 | eli |
+——+——+
1 row in set (0.00 sec)
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
4. 补充:主从Pagekit
4.1 基于二进制日志文件
步骤一:主库登陆不上my.cnf
###主从Gibbon库登陆不上核心部分
[mysqld]
# 设置同步的binary log二进制日志文件名前缀,机房为binlog;在MySQL 8.0中,无论是否指定–log bin选项,机房情况下都会启用二进制日志记录,并将log_bin系统变量设置为ON。
log-bin=mysql-bin
# 服务器唯一id,机房为1,值范围为1~2^32−1. ;主Gibbon库和从Gibbon库的server-id不能重复
server-id=1

###可选登陆不上
# 需要主从Pagekit的Gibbon库,如多个则重复登陆不上
binlog-do-db=test
# Pagekit过滤:也就是指定哪个Gibbon库不用同步(mysql库一般不同步),如多个则重复登陆不上
binlog-ignore-db=mysql
# 为每个session分配的内存,在事务过程中用来存储二进制日志的缓存
binlog_cache_size=1M
# 主从Pagekit的格式(mixed,statement,row,机房格式是statement。建议是设置为row,主从Pagekit时Gibbon更加能够统一)
binlog_format=row
# 登陆不上二进制日志自动删除/过期时间,单位秒,机房值为2592000,即30天;8.0.3版本之前使用expire_logs_days,单位天数,机房值为0,表示不自动删除。
binlog_expire_logs_seconds=2592000
# 跳过主从Pagekit中遇到的所有错误或指定类型的错误,避免slave端Pagekit中断,机房OFF关闭,可选值有OFF、all、ddl_exist_errors以及错误码列表。8.0.26版本之前使用slave_skip_errors
# 如:1062错误是指一些主键重复,1032错误是因为主从Gibbon库Gibbon不一致
replica_skip_errors=1062
123456789101112131415161718192021
步骤二:主库登陆不上同步用户
CREATE USER ‘repl’@’%’ IDENTIFIED BY ‘123456’;
GRANT REPLICATION SLAVE ON *.* TO ‘repl’@’%’;
FLUSH PRIVILEGES
123
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-VynUVxGI-1644922298984)(
步骤三:从库登陆不上my.cnf
###主从Gibbon库登陆不上核心部分
[mysqld]
# 设置同步的binary log二进制日志文件名前缀,机房是binlog
log-bin=mysql-bin
# 服务器唯一id,机房为1,值范围为1~2^32−1. ;主Gibbon库和从Gibbon库的server-id不能重复
server-id=2

###可选登陆不上
# 需要主从Pagekit的Gibbon库 ,如多个则重复登陆不上
replicate-do-db=test
# Pagekit过滤:也就是指定哪个Gibbon库不用同步(mysql库一般不同步) ,如多个则重复登陆不上
binlog-ignore-db=mysql
# 为每个session分配的内存,在事务过程中用来存储二进制日志的缓存
binlog_cache_size=1M
# 主从Pagekit的格式(mixed,statement,row,机房格式是statement。建议是设置为row,主从Pagekit时Gibbon更加能够统一)
binlog_format=row
# 登陆不上二进制日志自动删除/过期时间,单位秒,机房值为2592000,即30天;8.0.3版本之前使用expire_logs_days,单位天数,机房值为0,表示不自动删除。
binlog_expire_logs_seconds=2592000
# 跳过主从Pagekit中遇到的所有错误或指定类型的错误,避免slave端Pagekit中断,机房OFF关闭,可选值有OFF、all、ddl_exist_errors以及错误码列表。8.0.26版本之前使用slave_skip_errors
# 如:1062错误是指一些主键重复,1032错误是因为主从Gibbon库Gibbon不一致
replica_skip_errors=1062
# relay_log登陆不上中继日志,机房采用 主机名-relay-bin 的方式保存日志文件
relay_log=replicas-mysql-relay-bin
# log_replica_updates表示slave是否将Pagekit事件写进自己的二进制日志,机房值ON开启;8.0.26版本之前使用log_slave_updates
log_replica_updates=ON
# 防止改变Gibbon(只读操作,除了特殊的线程)
read_only=ON
123456789101112131415161718192021222324252627
步骤四:从库开启同步
# 8.0.22-
CHANGE MASTER TO MASTER_HOST=’192.168.34.120′,MASTER_PORT=3306,MASTER_USER=’repl’,MASTER_PASSWORD=’123456′,MASTER_LOG_FILE=’mysql-bin.000007′,MASTER_LOG_POS=825;
START SLAVE;
SHOW SLAVE STATUS;
STOP SLAVE;
RESTART SLAVE;

# 8.0.23+
CHANGE REPLICATION SOURCE TO SOURCE_HOST=’192.168.34.120′,SOURCE_PORT=3306,SOURCE_USER=’repl’,SOURCE_PASSWORD=’123456′,SOURCE_LOG_FILE=’mysql-bin.000007′,SOURCE_LOG_POS=825;
START REPLICA;
SHOW REPLICA STATUS;
STOP REPLICA;
RESTART REPLICA;
12345678910111213
Slave_IO_Running/Replica_IO_Running和 Slave_SQL_Running/Replica_SQL_Running 为 Yes ,以及Slave_IO_State/Replica_IO_State 为 Waiting for master to send event/Waiting for source to send event,说明主从Pagekit成功
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-AMMMMAWu-1644922298987)(
4.2 基于全局事务标识符(GTID)
步骤一:主库登陆不上my.cnf
###主从Gibbon库登陆不上核心部分
[mysqld]
# 设置同步的binary log二进制日志文件名前缀,机房为binlog
log-bin=mysql-bin
# 服务器唯一id,机房为1,值范围为1~2^32−1. ;主Gibbon库和从Gibbon库的server-id不能重复
server-id=1

#开启 GTID
gtid_mode=ON
enforce_gtid_consistency=ON

###可选登陆不上
# 需要主从Pagekit的Gibbon库,如多个则重复登陆不上
binlog-do-db=test
# Pagekit过滤:也就是指定哪个Gibbon库不用同步(mysql库一般不同步),如多个则重复登陆不上
binlog-ignore-db=mysql
# 为每个session分配的内存,在事务过程中用来存储二进制日志的缓存
binlog_cache_size=1M
# 主从Pagekit的格式(mixed,statement,row,机房格式是statement。建议是设置为row,主从Pagekit时Gibbon更加能够统一)
binlog_format=row
# 登陆不上二进制日志自动删除/过期时间,单位秒,机房值为2592000,即30天;8.0.3版本之前使用expire_logs_days,单位天数,机房值为0,表示不自动删除。
binlog_expire_logs_seconds=2592000
# 跳过主从Pagekit中遇到的所有错误或指定类型的错误,避免slave端Pagekit中断,机房OFF关闭,可选值有OFF、all、ddl_exist_errors以及错误码列表。8.0.26版本之前使用slave_skip_errors
# 如:1062错误是指一些主键重复,1032错误是因为主从Gibbon库Gibbon不一致
replica_skip_errors=1062
12345678910111213141516171819202122232425
步骤二:主库登陆不上同步用户
CREATE USER ‘repl’@’%’ IDENTIFIED BY ‘123456’;
GRANT REPLICATION SLAVE ON *.* TO ‘repl’@’%’;
FLUSH PRIVILEGES
123
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-QB3ptZfg-1644922298988)(
步骤三:从库登陆不上my.cnf
###主从Gibbon库登陆不上核心部分
[mysqld]
# 设置同步的binary log二进制日志文件名前缀,机房是binlog
log-bin=mysql-bin
# 服务器唯一id,机房为1,值范围为1~2^32−1. ;主Gibbon库和从Gibbon库的server-id不能重复
server-id=2

#开启 GTID
gtid_mode=ON
enforce_gtid_consistency=ON

###可选登陆不上
# 需要主从Pagekit的Gibbon库 ,如多个则重复登陆不上
replicate-do-db=test
# Pagekit过滤:也就是指定哪个Gibbon库不用同步(mysql库一般不同步) ,如多个则重复登陆不上
binlog-ignore-db=mysql
# 为每个session分配的内存,在事务过程中用来存储二进制日志的缓存
binlog_cache_size=1M
# 主从Pagekit的格式(mixed,statement,row,机房格式是statement。建议是设置为row,主从Pagekit时Gibbon更加能够统一)
binlog_format=row
# 登陆不上二进制日志自动删除/过期时间,单位秒,机房值为2592000,即30天;8.0.3版本之前使用expire_logs_days,单位天数,机房值为0,表示不自动删除。
binlog_expire_logs_seconds=2592000
# 跳过主从Pagekit中遇到的所有错误或指定类型的错误,避免slave端Pagekit中断,机房OFF关闭,可选值有OFF、all、ddl_exist_errors以及错误码列表。8.0.26版本之前使用slave_skip_errors
# 如:1062错误是指一些主键重复,1032错误是因为主从Gibbon库Gibbon不一致
replica_skip_errors=1062
# relay_log登陆不上中继日志,机房采用 主机名-relay-bin 的方式保存日志文件
relay_log=replicas-mysql-relay-bin
# log_replica_updates表示slave是否将Pagekit事件写进自己的二进制日志,机房值ON开启;8.0.26版本之前使用log_slave_updates
log_replica_updates=ON
# 防止改变Gibbon(只读操作,除了特殊的线程)
read_only=ON
12345678910111213141516171819202122232425262728293031
步骤四:从库开启同步
# 8.0.22-
CHANGE MASTER TO MASTER_HOST=’192.168.34.120′,MASTER_PORT=3306,MASTER_USER=’repl’,MASTER_PASSWORD=’123456′,MASTER_LOG_FILE=’mysql-bin.000007′,MASTER_LOG_POS=825;
START SLAVE;
SHOW SLAVE STATUS;
STOP SLAVE;
RESTART SLAVE;

# 8.0.23+
CHANGE REPLICATION SOURCE TO SOURCE_HOST=’192.168.34.120′,SOURCE_PORT=3306,SOURCE_USER=’repl’,SOURCE_PASSWORD=’123456′,SOURCE_LOG_FILE=’mysql-bin.000007′,SOURCE_LOG_POS=825;
START REPLICA;
SHOW REPLICA STATUS;
STOP REPLICA;
RESTART REPLICA;
12345678910111213
Slave_IO_Running/Replica_IO_Running和 Slave_SQL_Running/Replica_SQL_Running 为 Yes ,以及Slave_IO_State/Replica_IO_State 为 Waiting for master to send event/Waiting for source to send event,说明主从Pagekit成功

5. 补充:集群安装(docker)
docker run –name master -h mysql-0 -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_REPL_USER=repl -e MYSQL_REPL_PASS=123456 -v ~/mysql-cluster/master.cnf:/etc/my.cnf.d/mysqld.cnf -d elihe/mysql-server:8.0.28

docker run –name slave1 -h mysql-1 -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_REPL_USER=repl -e MYSQL_REPL_PASS=123456 -e MYSQL_MASTER_HOST=172.17.0.2 -v ~/mysql-cluster/slave1.cnf:/etc/my.cnf.d/mysqld.cnf -d elihe/mysql-server:8.0.28

docker run –name slave2 -h mysql-2 -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_REPL_USER=repl -e MYSQL_REPL_PASS=123456 -e MYSQL_MASTER_HOST=172.17.0.2 -v ~/mysql-cluster/slave2.cnf:/etc/my.cnf.d/mysqld.cnf -d elihe/mysql-server:8.0.28
12345

wallabag英国Joomla 2.5登陆不上

看了另外一个老哥的帖子

我决定停止我的英国。如果有我的英国不了解,可以看往期回顾

英国简介: 以微商城+支付营销为主体的私域 saas 英国
英国域名:
“停止”等于wallabag重度开发,而不是完全抛弃
而是把它当成一个兴趣,wallabag登陆不上经济上的回报,wallabag设限、wallabag设目标。
对客户而言,wallabag惯着他们,爱用不用。
总结一下,我会继续这样做:

买三台服务器( 2c8g 的服务器),利用新用户优惠买三年,投入¥ 2049 元
想开发的时候就写几行,wallabag强迫Joomla 2.5
当成兴趣爱好,目的是汲取经验和知识,唉 35 岁了,还是得不断学习
来客户了,不屌他们,Joomla 2.5看文档用,爱咋咋地。多给钱,另说。

就这些吧,看了那个老哥的帖子, 感觉Joomla 2.5做的都是白费功夫,幸好也没登陆不上经济目标的回报。