服务器环境
系统信息
NAME="Loongnix-Server Linux"
VERSION="8"
ID="loongnix-server"
ID_LIKE="rhel fedora centos"
VERSION_ID="8"
PLATFORM_ID="platform:lns8"
PRETTY_NAME="Loongnix-Server Linux 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:loongnix-server:loongnix-server:8"
HOME_URL="http://www.loongnix.cn/"
BUG_REPORT_URL="http://bugs.loongnix.cn/"
CENTOS_MANTISBT_PROJECT="Loongnix-server-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
处理器架构
Architecture: loongarch64
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-31
Thread(s) per core: 1
Core(s) per socket: 16
Socket(s): 2
NUMA node(s): 2
CPU family: Loongson-64bit
Model name: Loongson-3C5000
BogoMIPS: 4400.00
L1d cache: 64K
L1i cache: 64K
L2 cache: 256K
L3 cache: 16384K
NUMA node0 CPU(s): 0-15
NUMA node1 CPU(s): 16-31
Flags: cpucfg lam ual fpu lsx lasx complex crypto lvz lbt_x86 lbt_arm lbt_mips
openGauss描述
openGauss-5.0.2 迁移说明:
openGauss-5.0.2-loongarch64-all.tar.gz
包含了官网 https://opengauss.org/zh/download/
openGauss Server
部分的 openGauss_5.0.2 企业版 的全部内容
openGauss-5.0.2-loongarch64-connectors.tar.gz
包含了官网 https://opengauss.org/zh/download/
openGauss Connectors
部分的全部 4 个驱动程序的内容。
其中 bbox (程序崩溃时生成 coredump 的功能), llvm ( jit 功能) 2 个功能模块没有迁移, 应该不影响正常使用。
缺少 128 原子指令,使用自旋锁软实现。
部署
单机版安装
参考文档:https://docs-opengauss.osinfra.cn/zh/docs/5.0.0/docs/InstallationGuide/%E5%8D%95%E8%8A%82%E7%82%B9%E5%AE%89%E8%A3%85.html
安装步骤
tar -zxvf openGauss-5.0.2-loongarch64-all.tar.gz
cd openGauss-5.0.2-loongarch64-all
tar -jxf openGauss-5.0.2-loongnix-64bit.tar.bz2 -C /mnt/openGauss
cd /mnt/openGauss/simpleInstall
sh install.sh -w "数据库密码" &&source ~/.bashrc
数据库操作
-- 连接数据库
gsql -d postgres -p 5432
-- 停止数据库
gs_ctl stop -D $GAUSSHOME/data/single_node -Z single_node
-- 启动数据库
gs_ctl start -D $GAUSSHOME/data/single_node -Z single_node
远程访问设置
- 停止数据库
- 修改
postgresql.conf
里面的listen_addresses
vim $GAUSSHOME/data/single_node postgresql.conf
listen_addresses = '*'
- 启动数据库
集群方式安装
参考文档:https://docs-opengauss.osinfra.cn/zh/docs/5.0.0/docs/InstallationGuide/%E4%BC%81%E4%B8%9A%E7%89%88%E5%AE%89%E8%A3%85.html
安装步骤
mkdir -p /mnt/openGauss
chmod 755 -R /mnt/openGauss
tar -zxvf openGauss-5.0.2-loongarch64-all.tar.gz -C /mnt/openGauss
cd /mnt/openGauss/script/openGauss-5.0.2-loongarch64-all
tar -zxvf openGauss-5.0.2-loongnix-64bit-om.tar.gz
cd script
cp gspylib/etc/conf/cluster_config_template.xml ./cluster_config.xml
根据实际情况修改 cluster_config.xml
中机器的 ip
和 数据库安装目录
集群需要 ssh 互信,提前安装 expect
yum install expect
./gs_preinstall -U omm -G dbgrp -X /mnt/openGauss/openGauss-5.0.2-loongarch64-all/script/cluster_config.xml
su - omm
gs_install -X /mnt/openGauss/openGauss-5.0.2-loongarch64-all/script/cluster_config.xml
# 查看集群信息
gs_om -t status --detail
# 连接数据库
gsql -d postgres -p 15400
注意:
openGauss 安装的时候在 /etc/profile 里面修改了系统的 LD_LIBRARY_PATH,或者是 ~/.bashrc 里面修改了LD_LIBRARY_PATH , 由于 openGauss 自带了 openssl.so , libcrypto.so 等动态库,可能会导致系统执行 sudo, su , yum 等命令的时候报错。
重置 LD_LIBRARY_PATH 后再次执行。
export LD_LIBRARY_PATH=
远程访问设置
与单机版安装中设置一样。
设置开机服务
设置gs_ctl
工具的软连接
ln -s /mnt/openGauss/bin/gs_ctl /usr/local/bin
创建/etc/systemd/system/openGauss.service
文件并添加服务配置
[Unit]
Description=華為openGauss數據庫服務...
After=network.target
[Service]
Type=forking
User=omm
Group=dbgrp
Environment="GAUSSHOME=/mnt/openGauss"
# 直接設置成LD_LIBRARY_PATH變量的值
Environment="LD_LIBRARY_PATH=/mnt/openGauss/lib"
ExecStart=/usr/local/bin/gs_ctl start -D /mnt/openGauss/data/single_node
ExecReload=/usr/local/bin/gs_ctl restart -D /mnt/openGauss/data/single_node
ExecStop=/usr/local/bin/gs_ctl stop -D /mnt/openGauss/data/single_node
SuccessExitStatus=143
Restart=always
[Install]
WantedBy=multi-user.target
重新加载服务
sudo systemctl daemon-reload
重启服务
sudo systemctl start openGauss.service
查看服务状态
● openGauss.service - 華為openGauss數據庫服務...
Loaded: loaded (/etc/systemd/system/openGauss.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2024-08-26 23:33:27 EDT; 3h 1min ago
Process: 10875 ExecStart=/usr/local/bin/gs_ctl start -D /mnt/openGauss/data/single_node (code=exited, status=0/SUCCESS)
Main PID: 10878 (gaussdb)
Tasks: 36 (limit: 829805)
Memory: 556.0M
CGroup: /system.slice/openGauss.service
└─10878 /mnt/openGauss/bin/gaussdb -D /mnt/openGauss/data/single_node
Aug 26 23:33:27 localhost.localdomain gs_ctl[10875]: 2024-08-26 23:33:27.296 [unknown] [unknown] localhost 1099036442640 0[0:0#0] 0 [EXECUTOR] DETAIL: N/A
Aug 26 23:33:27 localhost.localdomain gs_ctl[10875]: 2024-08-26 23:33:27.296 [unknown] [unknown] localhost 1099036442640 0[0:0#0] 0 [EXECUTOR] CAUSE: Incorrect environment value.
Aug 26 23:33:27 localhost.localdomain gs_ctl[10875]: 2024-08-26 23:33:27.296 [unknown] [unknown] localhost 1099036442640 0[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.
Aug 26 23:33:27 localhost.localdomain gs_ctl[10875]: 2024-08-26 23:33:27.297 [unknown] [unknown] localhost 1099036442640 0[0:0#0] 0 [EXECUTOR] WARNING: Failed to obtain environment value $GAUSSLOG!
Aug 26 23:33:27 localhost.localdomain gs_ctl[10875]: 2024-08-26 23:33:27.297 [unknown] [unknown] localhost 1099036442640 0[0:0#0] 0 [EXECUTOR] DETAIL: N/A
Aug 26 23:33:27 localhost.localdomain gs_ctl[10875]: 2024-08-26 23:33:27.297 [unknown] [unknown] localhost 1099036442640 0[0:0#0] 0 [EXECUTOR] CAUSE: Incorrect environment value.
Aug 26 23:33:27 localhost.localdomain gs_ctl[10875]: 2024-08-26 23:33:27.297 [unknown] [unknown] localhost 1099036442640 0[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.
Aug 26 23:33:27 localhost.localdomain gs_ctl[10875]: [2024-08-26 23:33:27.974][10875][][gs_ctl]: done
Aug 26 23:33:27 localhost.localdomain gs_ctl[10875]: [2024-08-26 23:33:27.974][10875][][gs_ctl]: server started (/mnt/openGauss/data/single_node)
Aug 26 23:33:27 localhost.localdomain systemd[1]: Started 華為openGauss數據庫服務....
龙芯openGauss适配好的安装包,有需要的朋友关注后,发送龙芯openGauss
关键词即可获得!