1. 下载安装包
根据操作系统选择需要的版本,进行下载
本人安装在CentOS_x86_64下
2. 安装
注:当前安装未使用root
2.1 创建安装目录
mkdir ~/openGauss
2.2 解压安装包
tar -xvf openGauss-Lite-3.0.5-CentOS-x86_64.tar -C ~/openGauss
2.3 执行脚本安装
./install.sh --mode single -D ~/openGauss/data -R ~/openGauss/install --start
注:
安装过程产生如下两个问题
1)由于本人centos为最小安装,提示无 /sbin/ifconfig文件或目录
执行
sudo yum install net-tools.x86_64 -y
安装ifconfig命令
2)提示 the maximum number of SEMMNI is not correct 错误
$./install.sh --mode single -D ~/openGauss/data -R ~/openGauss/install --start the maximum number of SEMMNI is not correct, please change it (/proc/sys/kernel/sem)), ensure that the value of fourth sem is greater than 320.
需配置相应参数
执行
sudo vi /etc/sysctl.conf
内容中插入如下内容后保存
kernel.sem = 250 32000 100 999
再执行
sudo sysctl -p
2.4 数据库手工起停
启动
gs_ctl start -D /home/test/openGauss/data/
停止
gs_ctl stop -D /home/test/openGauss/data/
3. 检查安装结果
安装完成后会提示
[2024-06-03 20:20:13.938][21662][][gs_ctl]: done
[2024-06-03 20:20:13.938][21662][][gs_ctl]: server started (/home/test/openGauss/data)
start datanode success.
[2024-06-03 20:20:18.948][21747][][gs_ctl]: gs_ctl query ,datadir is /home/test/openGauss/data
HA state:
local_role : Normal
static_connections : 0
db_state : Normal
detail_information : Normal
Senders info:
No information
Receiver info:
No information
info:run cmd 'source /home/test/.bashrc' to make the environment variables take effect.
安装过程中会往.bashrc中写入环境变量,需要手工执行一下,否则后面的步骤会产生找不到指令错误
source /home/test/.bashrc
检查步骤1 : 执行命令 ps ux | grep gaussdb
$ ps ux | grep gaussdb
test 21666 1.8 0.6 2420456 165400 ? Ssl 20:20 0:00 /home/test/openGauss/install/bin/gaussdb -D /home/test/openGauss/data
test 21867 0.0 0.0 112724 984 pts/3 S+ 20:20 0:00 grep --color=auto gaussdb
检查步骤2 : 执行命令 gs_ctl query -D /home/test/openGauss/data
[2024-06-03 20:21:50.098][22323][][gs_ctl]: gs_ctl query ,datadir is /home/test/openGauss/data
HA state:
local_role : Normal
static_connections : 0
db_state : Normal
detail_information : Normal
Senders info:
No information
Receiver info:
No information
4. 初始化
4.1 登录
当前安装目录下执行 openGauss]$ install/bin/gsql -d postgres -p 5432 -r
$ gsql -d postgres -p 5432 -r
gsql ((openGauss 3.0.5 build 519ad618) compiled at 2023-12-23 16:22:42 commit 0 last mr release)
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
4.2 检查(pg指令)
1)检查用户
openGauss=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------------------------------------------------------------+-----------
test | Sysadmin, Create role, Create DB, Replication, Administer audit, Monitoradmin, Operatoradmin, Policyadmin, UseFT | {}
2)检查数据库
openGauss=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+--------+----------+-------------+-------------+-------------------
postgres | test | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | test | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/test +
| | | | | test=CTc/test
template1 | test | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/test +
| | | | | test=CTc/test
(3 rows)
3)初始化创建测试库
# 创建用户
openGauss=# create user opengauss createrole password 'asdf@123';
CREATE ROLE
# 创建数据库
openGauss=# CREATE DATABASE opengauss WITH dbcompatibility='B' OWNER=opengauss ENCODING='UTF-8';
CREATE DATABASE
# 切换数据库
openGauss=# \c opengauss
Non-SSL connection (SSL connection is recommended when requiring high-security)
You are now connected to database "opengauss" as user "test".
opengauss=#
4)导入数据
pg命令
\i /home/test/init.sql
5. 其他问题
新创建的用户opengauss可能登录出现locked导致无法登陆
gsql -h 127.0.0.1 -p 5432 -d test_db -U opengauss
Password for user opengauss:
gsql: (connect to V5 server) FATAL: The account has been locked.
(connect to V1 server) FATAL: The account has been locked.
需要登录后解锁
openGauss=# ALTER USER opengauss ACCOUNT UNLOCK;
ALTER ROLE