1. 安装环境
OS | 配置 |
---|---|
CentOS 7.8 | 4H16G |
2. 安装前准备
2.1 切换root用户,新建崖山数据库用户及用户组
# 新建用户
su - root
useradd yashan
# 新建组并分配
groupadd yashan
usermod -a -G yashan yashan
# 更改yashan用户密码
passwd yashan
Changing password for user yashan.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
2.2 配置sudo免密登录
查看文件权限,初始只读
ls -lh /etc/sudoers -r-x------. 1 root root 4.3K Apr 23 15:48 /etc/sudoers
增加写入权限,并添加sudo免密后,恢复权限
chmod +w /etc/sudoers
echo "yashan ALL=(ALL)NOPASSWD:ALL" >> /etc/sudoers
chmod +w /etc/sudoers
PS:(若免密这个步骤跳过,需先创建相关目录并授权给安装用户,比如当前为yashan用户)
当前使用/data/yashan安装,先进行授权(使用root用户操作)
mkdir /data/yashan chmod -R 770 /data/yashan chown -R yashan:yashan /data/yashan
2.3 优化系统参数并重启【配置永久生】
查看/etc/security/limits.conf,添加参数(若已存在则编辑修改)
echo "
* soft nofile 1048576
* hard nofile 1048576
* soft nproc 1048576
* hard nproc 1048576
* soft rss unlimited
* hard rss unlimited
* soft stack 8192
* hard stack 8192
" >> /etc/security/limits.conf
3. openssl依赖安装
当前centos版本,默认是OpenSSL 1.0.2k-fips
3.1 查看版本
[yashan@test100 install]$ openssl version OpenSSL 1.0.2k-fips 26 Jan 2017
3.2 查找当前openssl位置及备份
[root@test100 ~]# whereis openssl
openssl: /usr/bin/openssl /usr/lib64/openssl /usr/share/man/man1/openssl.1ssl.gz
# 备份
mv /usr/bin/openssl /usr/bin/openssl_bak1.0.2k-fips
mv /usr/lib64/openssl /usr/lib64/openssl_bak1.0.2k-fips
3.3 下载及安装
下载地址:https://www.openssl.org/source/old/1.1.1/
PS:当前版本推荐:openssl-1.1.1l.tar.gz ,当前测试,使用最新子版本openssl-1.1.1w.tar.gz
cd tools
# openssl下载
wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz
# 解压
tar xvf openssl-1.1.1w.tar.gz
# 编译及安装(用时较长,耐心等待)
$ cd openssl-1.1.1w/
$ ./config --prefix=/usr/local/openssl
$ make && make install
# 建立软连接
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl/ /usr/include/openssl
echo "/usr/local/openssl/lib/" >> /etc/ld.so.conf
## 解决找不到libssl.so.1.1 、libcrypto.so.1.1报错
ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
4. YashanDB 数据库安装
YashanDB 个人版下载地址:https://download.yashandb.com/download
4.1 切换用户并创建安装目录,上传安装包到 install 目录
su - yashan
mkdir /data/yashan/install
cd /data/yashan/install
# 上传到当前目录并解压
tar xvf yashandb-personal-23.2.3.100-linux-x86_64.tar.gz
4.2 生成参数文件
PS:集群名cluster自定义,当前为“virdb”,此影响后续的参数文件名及环境变量文件名
[yashan@test100 install]$ ./bin/yasboot package se gen --cluster virdb -u yashan -p yashan2024 --ip 172..0.0.100 --port 22 --install-path /data/yashan/yashan_home3 --data-path /data/yashan/yashan_data3 --begin-port 1689
host host0001 openssl version: OpenSSL 1.1.1w 11 Sep 2023 (Library: 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
-------------------------------------------------------------------------------------------------------------------
host0001 | dbg1 | db | 1-1 | 172..0.0.100:1689 | 172..0.0.100:1690 | /data/yashan/yashan_data3
----------+-------+-----------+-----------+--------------------+--------------------+------------------------------
Generate config success
4.3 执行安装
[yashan@test100 install]$ ./bin/yasboot package install -t hosts.toml -i yashandb-personal-23.2.3.100-linux-x86_64.tar.gz
host host0001 openssl version: OpenSSL 1.1.1w 11 Sep 2023 (Library: OpenSSL 1.1.1l 24 Aug 2021)
OpenSSL version is 1.1.1 or greater
checking install package...
install version: yashandb 23.2.3.100
host0001 100% [====================================================================] 12s
update host to yasom...
4.4 执行部署YashanDB数据库
[yashan@test100 install]$ ./bin/yasboot cluster deploy -t virdb.toml
type | uuid | name | hostid | index | status | return_code | progress | cost
---------------------------------------------------------------------------------------------------------
task | 291f902727cea7c2 | DeployYasdbCluster | - | virdb | SUCCESS | 0 | 100 | 10
------+------------------+--------------------+--------+-------+---------+-------------+----------+------
task completed, status: SUCCESS
4.5 环境变量设置(确认环境,若有旧版本,需要先清理)
cat /data/yashan/yashan_home3/yashandb/23.2.3.100/conf/virdb.bashrc >> ~/.bashrc
source ~/.bashrc
4.6 查看数据库库状态
[yashan@test100 conf]$ yasboot cluster status -c yashandb
file name: /home/yashan/.yasboot/yashandb.env, environment file is not exist, is command 'package install' already executed?
[yashan@test100 conf]$ yasboot cluster status -c virdb
host_id | node_type | nodeid | pid
---------------------------------------
host0001 | db | 1-1:1 | 11076
----------+-----------+--------+-------
4.7 更改数据库密码,空密码已经进不去了
[yashan@test100 conf]$ cd /data/yashan/yashan_data3/db-1-1/instance/
[yashan@test100 instance]$ mv yasdb.pwd yasdb1.pwd
[yashan@test100 instance]$ yaspwd file=yasdb.pwd
Enter password for SYS:vir#1346
4.8 查看数据库ID
PS: (自己密码自己看好哈^ ^)~~
[yashan@test100 instance]$ yasql sys/vir#1346
YashanDB SQL Personal Edition Release 23.2.3.100 x86_64
Connected to:
YashanDB Server Personal Edition Release 23.2.3.100 x86_64 - X86 64bit Linux
SQL> select database_id from v$database;
DATABASE_ID
---------------------
2002007620
1 row fetched.
6. 常见报错(解决方案均在上文中能找到)
6.1 报错环境变量已存在
[yashan@test100 install]$ ./bin/yasboot package se gen --cluster virvle -u yashan -p yashan2024 --ip 172..0.0.100 --port 22 --install-path /data/yashan/yashan_home --data-path /data/yashan/yashan_data --begin-port 1689
172..0.0.100
ip:172..0.0.100 scan failed, 主机扫描失败:host scan, stdout:hostid: host0001, file /home/yashan/.yasboot/virvle.env is already exist, confirm whether a cluster with the same name: 'virvle' has been deployed. you can delete /home/yashan/.yasboot/virvle.env manually or use '--force' skip check
, stderr: err:Process exited with status 1
hostid | group | node_type | node_name | listen_addr | replication_addr | data_path
------------------------------------------------------------------------------------------------------------------
host0001 | dbg1 | db | 1-1 | 172..0.0.100:1689 | 172..0.0.100:1690 | /data/yashan/yashan_data
----------+-------+-----------+-----------+--------------------+--------------------+-----------------------------
Generate config success
6.2 告警openssl版本过旧
[yashan@test100 install]$ ./bin/yasboot package se gen --cluster virdb -u yashan -p yashan2024 --ip 172..0.0.100 --port 22 --install-path /data/yashan/yashan_home3 --data-path /data/yashan/yashan_data3 --begin-port 1689 host host0001 openssl version: OpenSSL 1.0.2k-fips 26 Jan 2017 Warning: OpenSSL less than 1.1.1, it may cause installation failures, please upgrade OpenSSL to 1.1.1 or greater hostid | group | node_type | node_name | listen_addr | replication_addr | data_path ------------------------------------------------------------------------------------------------------------------- host0001 | dbg1 | db | 1-1 | 172..0.0.100:1689 | 172..0.0.100:1690 | /data/yashan/yashan_data3 ----------+-------+-----------+-----------+--------------------+--------------------+------------------------------ Generate config success
6.3 报错libssl.so.1.1加载不了
[root@test100 openssl-1.1.1w]# openssl version -a
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
[root@test100 openssl-1.1.1w]# openssl version
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
好了,YashanDB 最新版本的安装到此完成 ~
7. 卸载数据库
若安装完需要重装,或者需要卸载旧版本,来看看怎么卸载
7.1 清空集群
[yashan@test100 ~]$ yasboot cluster clean -c virdb --purge
Are you sure you want to CLEAN cluster: [virdb], AND ALL DATA WILL BE DELETED (-p/--purge is given)?
[yes/no]: yes
type | uuid | name | hostid | index | status | return_code | progress | cost
--------------------------------------------------------------------------------------------------------
task | e8de2e1ddf6a6fb6 | CleanYasdbCluster | - | virdb | SUCCESS | 0 | 100 | 2
------+------------------+-------------------+--------+-------+---------+-------------+----------+------
task completed, status: SUCCESS
此步完成后,可执行4.4再次部署
7.2 卸载数据库
[yashan@test100 install]$ ./bin/yasboot package uninstall -c virdb
type | uuid | name | hostid | index | status | return_code | progress | cost
-------------------------------------------------------------------------------------------------------
task | 49787722a3cdb5db | PackageUninstall | - | virdb | SUCCESS | 0 | 100 | -
------+------------------+------------------+--------+-------+---------+-------------+----------+------
task completed, status: SUCCESS
PS:此步完成后,可执行4.3再次安装,当然,若是相关设置需要改变,那就按照“4. YashanDB 数据库安装”再来一遍
最后修改时间:2024-09-25 09:27:31
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。