Ubuntu 22.04 如何从 tarball 安装 mariadb 10.1.48 二进制文件问题/错误

问题描述 投票:0回答:1

我知道这是一个非常老的问题,我在每个网络部分(包括堆栈溢出)中进行了搜索,但我没有找到适合我需要的解决方案,所以我想请求你的帮助。

我偶然发现的问题是我正在从 Windows 系统迁移到 ubuntu 22.4 系统。在 Windows 中,我们的 mariadb 数据库运行的是 10.1.48 版本,因此我的想法是在 ubuntu 上安装相同版本,以避免在将 mariadb 升级到新版本之前出现问题。

所以我知道更好的解决方案是从二进制文件( tarball )安装,所以我从这个存储库下载了 tarball

https://archive.mariadb.org/mariadb-10.1.48/bintar-linux-systemd-x86_64/

然后我找到了两个指南来帮助我完成这项工作。

https://www.digitalocean.com/community/tutorials/how-to-install-mariadb-from-binary-tarballs-on-ubuntu-13-10
https://mariadb.com/kb/en/installing-mariadb-binary-tarballs/

遵循我希望遵循的这些指南:

  1. 在 /usr/local/mysql 文件夹上安装 mariadb -_mysql 是 mariadb10.1.48 真实文件夹的符号链接
  2. 在 /usr/mysql/ 中创建 my.cnf 并配置 datadir
  3. 在 /usr/lib/systemd/system 中创建 mariadb.service
  4. 在 /usr/lib/systemd/system 中创建一个名为“mariadb.service.d”的文件夹,并在包含 dis 内容的文件 datadir.conf 内创建一个文件夹名称“mariadb.service.d” “[服务] ReadWritePaths=/usr/local/mysql/data”(覆盖 mariadb.service 中设置的标志“ProtectSystem=full”)
  5. 启动 systemctl start mariadb.service 让所有服务运行起来。

my.cnf 配置文件

[mysqld]
# === Required Settings ===
basedir                         = /usr/local/mysql      #  /usr
bind_address                    = 0.0.0.0               # 127.0.0.1  
datadir                         = /usr/local/mysql/data     #  original was : /var/lib/mysql    
#default_authentication_plugin  = mysql_native_password # Enable in MySQL 8+ or MariaDB 10.6+ for backwards compatibility with common CMSs
max_allowed_packet              = 256M
max_connect_errors              = 1000000
pid_file                        = /tmp/mysqld.pid       #/usr/local/mysql/data/mysqld.pid  /var/run/mysqld/mysqld.pid
port                            = 3306
skip_external_locking
skip_name_resolve
socket                          = /tmp/mysql.sock      # /var/run/mysqld/mysqld.sock
tmpdir                          = /tmp
user                            = mysql

......
log_error                       = /var/log/mysql/mysql_error.log
log_queries_not_using_indexes   = 0     # Disabled on production
long_query_time                 = 5
slow_query_log                  = 0     # Disabled on production
slow_query_log_file             = /var/log/mysql/mysql_slow.log
lc_messages_dir                 = /usr/local/mysql/share

mariadb.service 文件

PrivateDevices=false

# Prevent writes to /usr, /boot, and /etc
ProtectSystem=full

# Doesn't yet work properly with SELinux enabled
# NoNewPrivileges=true

# Prevent accessing /home, /root and /run/user
ProtectHome=true

# Execute pre and post scripts as root, otherwise it does it as User=
PermissionsStartOnly=true

ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \
 VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] \
 && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1"

ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/mysql/my.cnf --user=mysql
....

我发现的问题是,当我启动 systemctl start mariadb.service 时,服务返回此状态 /var/log/mysql/mysql_error.log

2024-02-16 18:43:27 140054274315264 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2024-02-16 18:43:27 140054274315264 [Note] InnoDB: The InnoDB memory heap is disabled
2024-02-16 18:43:27 140054274315264 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2024-02-16 18:43:27 140054274315264 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2024-02-16 18:43:27 140054274315264 [Note] InnoDB: Compressed tables use zlib 1.2.11
2024-02-16 18:43:27 140054274315264 [Note] InnoDB: Using Linux native AIO
2024-02-16 18:43:27 140054274315264 [Note] InnoDB: Using SSE crc32 instructions
2024-02-16 18:43:28 140054274315264 [Note] InnoDB: Initializing buffer pool, size = 4.0G
2024-02-16 18:43:28 140054274315264 [Note] InnoDB: Completed initialization of buffer pool
2024-02-16 18:43:28 140054274315264 [Note] InnoDB: Highest supported file format is Barracuda.
2024-02-16 18:43:28 140054274315264 [Warning] InnoDB: Resizing redo log from 2*3072 to 2*65536 pages, LSN=1616713
2024-02-16 18:43:28 140054274315264 [Warning] InnoDB: Starting to delete and rewrite log files.
2024-02-16 18:43:28 140054274315264 [Note] InnoDB: Setting log file ./ib_logfile101 size to 1024 MB
2024-02-16 18:43:30 140054274315264 [Note] InnoDB: Setting log file ./ib_logfile1 size to 1024 MB
2024-02-16 18:43:31 140054274315264 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2024-02-16 18:43:31 140054274315264 [Warning] InnoDB: New log files created, LSN=1616908
2024-02-16 18:43:31 140054274315264 [Note] InnoDB: 128 rollback segment(s) are active.
2024-02-16 18:43:31 140054274315264 [Note] InnoDB: Waiting for purge to start
2024-02-16 18:43:31 140054274315264 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.49-89.0 started; log sequence number 1616713
2024-02-16 18:43:31 140048129291840 [Note] InnoDB: Dumping buffer pool(s) not yet started
2024-02-16 18:43:31 140054274315264 [Note] Plugin 'FEEDBACK' is disabled.
2024-02-16 18:43:31 140054274315264 [Note] Server socket created on IP: '0.0.0.0'.
2024-02-16 18:43:31 140054274315264 [Warning] 'user' entry 'root@sharpub' ignored in --skip-name-resolve mode.
2024-02-16 18:43:31 140054274315264 [Warning] 'user' entry '@sharpub' ignored in --skip-name-resolve mode.
2024-02-16 18:43:31 140054274315264 [Warning] 'proxies_priv' entry '@% root@sharpub' ignored in --skip-name-resolve mode.
2024-02-16 18:43:31 140054274315264 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '10.1.48-MariaDB'  socket: '/tmp/mysql.sock'  port: 3306  MariaDB Server

但随后卡住了...并在 mariadb.service 中的 TimeoutStartSec=900 之后收到超时。

我注意到两件事 。我看到 /usr/local/mysql/ib_logfile0 +ib_logfile1 中的文件大小从 50.331.648K 跳到 1.073.741.824 。我尝试手动启动 /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf --user=mysql & ......似乎一切都好。我的意思是我没有收到任何超时并且没有挂起。

我确信问题出在我的知识和我设置的配置上,但我不知道如何解决它。 我也不知道我希望安装到 /usr/local 是否是 ubuntu 的正确行为。

有人可以帮我解决这个问题吗? 预先感谢大家。

mariadb mariadb-10.1
1个回答
0
投票

感谢您给了我一些启发:

我会尝试保持当前的方法,之后,如果我没有解决它,我会尝试按照建议安装10.11。

首先: Type=Notify 是什么意思? ..您是否看到我在配置中设置的一些标志或其他什么?这意味着什么 第二:这是您建议的有关 ldd 命令的输出:

root@SharpUB:~# ldd -r /usr/local/mysql/bin/mysqld
    linux-vdso.so.1 (0x00007fff6d941000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1fe1484000)
    libaio.so.1 => /lib/x86_64-linux-gnu/libaio.so.1 (0x00007f1fe147f000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f1fe147a000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f1fe1440000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1fe143b000)
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1fe120f000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1fe1126000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1fe0efd000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f1fe1498000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1fe0edd000)

我可以检查什么?...如果我的系统上存在所有这些对象? .. 进而 ? 谢谢...

© www.soinside.com 2019 - 2024. All rights reserved.