1、选择合适的操作系统
最开始笔者采用AlmaLinux9.2,前面各种设置都没有问题,都很顺利,但是到openssl就解决不了了。崖山数据库要求openssl版本是1.1.1,但是AlmaLinux9.2默认是3.2.2,太高了。
第一反应选择降级处理,但是很快就发现,openssl被sudo所依赖,考虑到即使不使用sudo,也可以使用账号密码登录,于是尝试添加 --skip-broken 进行卸载,根据提示又添加 --nobest ,结果还是无法降级或卸载。然后放弃,尝试使用CentOS7.9。
2、根据官方文档
gmssl应3.1.1及以上,lz4应1.9.3及以上,zlib应1.2.12及以上,zstd应1.5.2及以上,monit应5.28.0及以上。
于是,笔者又开始解决这些软件的版本问题,但是,后来发现这些版本都不是标准yum源(CentOS、阿里、清华等)所拥有的。解决起来相当痛苦,依赖太多了。跟网友交流发现,似乎不需要解决也能成功安装。
系统默认版本如下:
[root@localhost ~]# rpm -qa|grep -E "gmssl|lz4|zlib|zstd|monit"
zlib-1.2.7-21.el7_9.x86_64
lz4-1.8.3-1.el7.x86_64
[root@localhost ~]#
3、接下来就是比较顺利的安装体验过程。详细记录如下:
(1)安装虚机(笔者用的是CentOS7.9-mini版),虚机基本配置:CPU:4C,MEM:8G。
(2)设置主机名
[root@localhost ~]# hostnamectl set-hostname yashandb
[root@localhost ~]# cat /etc/hostname
yashandb
[root@localhost ~]#
配置还有很多,后面统一重启电脑,暂未生效先不管了。
(3)设置/etc/hosts文件
[root@localhost ~]# echo "192.168.15.100 yashandb" >> /etc/hosts
[root@localhost ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.15.100 yashandb
[root@localhost ~]#
(4)关闭交换分区
[root@localhost ~]# sysctl -w vm.swappiness=0
vm.swappiness = 0
[root@localhost ~]# echo "vm.swappiness = 0">> /etc/sysctl.conf
[root@localhost ~]# sysctl -a | grep swappiness
sysctl: reading key "net.ipv6.conf.all.stable_secret"
sysctl: reading key "net.ipv6.conf.default.stable_secret"
sysctl: reading key "net.ipv6.conf.ens32.stable_secret"
sysctl: reading key "net.ipv6.conf.lo.stable_secret"
vm.swappiness = 0
[root@localhost ~]#
(5)调整自动分配本地端口范围
echo "net.ipv4.ip_local_port_range = 32768 60999" >> /etc/sysctl.conf
(6)调整进程的VMA上限
[root@localhost ~]# sysctl -w vm.max_map_count=2000000
vm.max_map_count = 2000000
[root@localhost ~]# echo "vm.max_map_count=2000000" >> /etc/sysctl.conf
[root@localhost ~]# sysctl -a|grep vm.max_map_count
sysctl: reading key "net.ipv6.conf.all.stable_secret"
sysctl: reading key "net.ipv6.conf.default.stable_secret"
sysctl: reading key "net.ipv6.conf.ens32.stable_secret"
sysctl: reading key "net.ipv6.conf.lo.stable_secret"
vm.max_map_count = 2000000
[root@localhost ~]#
(7)调整资源限制值
[root@localhost ~]# echo "
* soft nofile 65536
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536
* soft rss unlimited
* hard rss unlimited
* soft stack 8192
* hard stack 8192
" >> /etc/security/limits.conf
[root@localhost ~]# cat /etc/security/limits.conf | tail -15
#ftp hard nproc 0
#@student - maxlogins 4
# End of file
* soft nofile 65536
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536
* soft rss unlimited
* hard rss unlimited
* soft stack 8192
* hard stack 8192
[root@localhost ~]#
(8)关闭透明大页
[root@localhost ~]# echo '
> echo never > /sys/kernel/mm/transparent_hugepage/defrag
> echo never > /sys/kernel/mm/transparent_hugepage/enabled
> ' >> /etc/rc.d/rc.local
[root@localhost ~]# cat /etc/rc.d/rc.local | tail -5
touch /var/lock/subsys/local
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
[root@localhost ~]# chmod 755 /etc/rc.d/rc.local
[root@localhost ~]# ls -l /etc/rc.d/rc.local
-rwxr-xr-x. 1 root root 588 Dec 18 03:05 /etc/rc.d/rc.local
[root@localhost ~]#
(9)关闭防火墙、Selinux
[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
[root@localhost ~]# cat /etc/selinux/config |grep -w "^SELINUX"
SELINUX=disabled
[root@localhost ~]#
(10)重启系统
[root@localhost ~]# init 6
至此,各项准备工作基本结束。
4、开始安装
(1)安装openssl 1.1.1版本
[root@yashandb ~]# yum install -y gcc make wget net-tools perl
[root@yashandb ~]# wget https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1l/openssl-1.1.1l.tar.gz
[root@yashandb ~]# tar -zxf openssl-1.1.1l.tar.gz
[root@yashandb ~]# mkdir -p /usr/local/openssl
[root@yashandb ~]# ./config --prefix=/usr/local/openssl no-zlib
[root@yashandb ~]# make -j 4 && make install
[root@yashandb openssl]# mv /usr/bin/openssl /usr/bin/openssl.bak
[root@yashandb openssl]# mv /usr/include/openssl /usr/include/openssl.bak
[root@yashandb openssl]# ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
[root@yashandb openssl]# ln -s /usr/local/openssl/include/openssl /usr/include/openssl
[root@yashandb openssl]# ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
[root@yashandb openssl]# ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
[root@yashandb openssl]# echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
[root@yashandb openssl]# ldconfig -v
[root@yashandb openssl]# openssl version
(2)配置sudo免密
[root@yashandb openssl]# echo "yashan ALL=(ALL)NOPASSWD:ALL" >> /etc/sudoers
[root@yashandb openssl]# tail /etc/sudoers
## Allows members of the users group to mount and unmount the
## cdrom as root
# %users ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom
## Allows members of the users group to shutdown this system
# %users localhost=/sbin/shutdown -h now
## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
yashan ALL=(ALL)NOPASSWD:ALL
[root@yashandb openssl]#
(3)创建用户及用户组
[root@yashandb openssl]# groupadd YASDBA
[root@yashandb openssl]# useradd -d /home/yashan -m yashan -G YASDBA
[root@yashandb openssl]# echo "hellodba" | passwd --stdin yashan
Changing password for user yashan.
passwd: all authentication tokens updated successfully.
[root@yashandb openssl]# mkdir -p /YashanDB
[root@yashandb openssl]# chmod -R 777 /YashanDB
[root@yashandb openssl]#
(4)下载yashandb-23.2.4.100-linux-x86_64.tar.gz软件
[root@yashandb ~]# su - yashan
[yashan@yashandb ~]$ mkdir install
[yashan@yashandb ~]$ cd install
[yashan@yashandb ~]$ wget https://linked.yashandb.com/upload1010/yashandb-23.2.4.100-linux-x86_64.tar.gz
[yashan@yashandb ~]$ tar -zxf yashandb-23.2.4.100-linux-x86_64.tar.gz
(5)安装数据库
[yashan@yashandb install]$ ./bin/yasboot package se gen --cluster yashandb --recommend-param \
> -u yashan -p hellodba --ip 192.168.15.100 --port 22 \
> --install-path /YashanDB/yashan/yasdb_home --data-path /YashanDB/yashan/yasdb_data \
> --begin-port 1688
host host0001 openssl version: OpenSSL 1.1.1l 24 Aug 2021
OpenSSL version is 1.1.1 or greater
host host0001 openssl version: OpenSSL 1.1.1l 24 Aug 2021
OpenSSL version is 1.1.1 or greater
hostid | group | node_type | node_name | listen_addr | replication_addr | data_path | memory_limit
-----------------------------------------------------------------------------------------------------------------------------------
host0001 | dbg1 | db | 1-1 | 192.168.15.100:1688 | 192.168.15.100:1689 | /YashanDB/yashan/yasdb_data | 6242M
----------+-------+-----------+-----------+---------------------+---------------------+-----------------------------+--------------
Generate config completed
[yashan@yashandb install]$ ./bin/yasboot package install -t hosts.toml -i yashandb-23.2.4.100-linux-x86_64.tar.gz
host host0001 openssl version: OpenSSL 1.1.1l 24 Aug 2021
OpenSSL version is 1.1.1 or greater
checking install package...
install version: yashandb 23.2.4.100
host0001 100% [====================================================================] 3s
update host to yasom...
[yashan@yashandb install]$ ./bin/yasboot cluster deploy -t yashandb.toml
type | uuid | name | hostid | index | status | return_code | progress | cost
------------------------------------------------------------------------------------------------------------
task | 4b7a11024cfaaebb | DeployYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 21
------+------------------+--------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS
[yashan@yashandb install]$ source /home/yashan/install/conf/yashandb.bashrc
[yashan@yashandb install]$ cat /home/yashan/install/conf/yashandb.bashrc >> ~/.bashrc
[yashan@yashandb install]$ yasboot cluster password set -n yasdb_123 -c yashandb
type | uuid | name | hostid | index | status | return_code | progress | cost
----------------------------------------------------------------------------------------------------------
task | ab1c2cb8770b1fba | YasdbPasswordSet | - | yashandb | SUCCESS | 0 | 100 | 2
------+------------------+------------------+--------+----------+---------+-------------+----------+------
task completed, status: SUCCESS
[yashan@yashandb install]$ echo "export YASDB_DATA=/YashanDB/yashan/yasdb_data/db-1-1/" >>~/.bashrc
[yashan@yashandb install]$ yasboot cluster status -c yashandb -d
hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
------------------------------------------------------------------------------------------------------------------------------------------------------
host0001 | db | 1-1:1 | 15079 | open | normal | primary | 192.168.15.100:1688 | /YashanDB/yashan/yasdb_data/db-1-1
----------+-----------+--------+-------+-----------------+-----------------+---------------+---------------------+------------------------------------
[yashan@yashandb ~install]$ yasql / as sysdba
YashanDB SQL Enterprise Edition Release 23.2.4.100 x86_64
Connected to:
YashanDB Server Enterprise Edition Release 23.2.4.100 x86_64 - X86 64bit Linux
SQL> col HOST_NAME for a25;
SQL> col INSTANCE_NAME for a25;
SQL> col STATUS for a25;
SQL> SELECT HOST_NAME,INSTANCE_NAME,STATUS FROM V$INSTANCE;
HOST_NAME INSTANCE_NAME STATUS
------------------------- ------------------------- -------------------------
yashandb yasdb OPEN
1 row fetched.
SQL> exit
[yashan@install ~]$
(6)设置开机自启动
[root@yashandb db-1-1]# echo "
> su - yashan -c 'yasboot process yasom start -c yashandb'
> su - yashan -c 'yasboot process yasagent start -c yashandb'
> su - yashan -c 'yasboot cluster start -c yashandb'
> su - yashan -c 'yasboot monit start --cluster yashandb'
> " >> /etc/rc.local
[root@yashandb db-1-1]# tail /etc/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
su - yashan -c 'yasboot process yasom start -c yashandb'
su - yashan -c 'yasboot process yasagent start -c yashandb'
su - yashan -c 'yasboot cluster start -c yashandb'
su - yashan -c 'yasboot monit start --cluster yashandb'
[root@yashandb db-1-1]#
(7)重启测试
[root@yashandb db-1-1]# init 6
[root@yashandb ~]# su - yashan
Last login: Wed Dec 18 04:42:45 EST 2024 on pts/0
[yashan@yashandb ~]$ yasql / as sysdba
YashanDB SQL Enterprise Edition Release 23.2.4.100 x86_64
Connected to:
YashanDB Server Enterprise Edition Release 23.2.4.100 x86_64 - X86 64bit Linux
SQL> col HOST_NAME for a25;
SQL> col INSTANCE_NAME for a25;
SQL> col STATUS for a25;
SQL> SELECT HOST_NAME,INSTANCE_NAME,STATUS FROM V$INSTANCE;
HOST_NAME INSTANCE_NAME STATUS
------------------------- ------------------------- -------------------------
yashandb yasdb OPEN
1 row fetched.
SQL> exit
[yashan@yashandb ~]$
5、至此,安装验证全部结束。