南大通用数据库(gbase 8s) 在Centos7环境 集群安装
一、环境详情
软件版本
南大通用官网:下载
节点分配
二、Centos7 参数优化(所有节点)
- 关闭防火墙
- 关闭防火墙:
systemctl stop firewalld
- 禁止开机自启:
systemctl disable firewalld
- 修改系统最大进程数和最大文件打开数
vim /etc/security/limits.conf
修改以下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
修改进程数据限制
vim /etc/security/limits.d/90-nproc.conf
修改以下内容:
* soft nproc 1024
* soft nproc 2048
查看优化信息
ulimit -a
查看 RemoveIPC 参数值是否为 yes
loginctl show-session | grep RemoveIPC
systemctl show systemd-logind | grep RemoveIPC
如果为 yes,则需要修改;如果为 no,则无需继续执行后续步骤
vim /etc/systemd/logind.conf
将 RemoveIPC 参数值设置为 no,键入“:wq”保存并退出
vim /usr/lib/systemd/system/systemd-logind.service
将 RemoveIPC 参数值设置为 no,键入“:wq”保存并退出。
重新加载配置文件,执行以下命令:
systemctl daemon-reload
systemctl restart systemd-logind
关闭 SELINUX
sestatus
如果系统提示以下信息,说明 selinux 已被禁用:
SELinux status: disabled
否则执行以下命令
sudo vim /etc/selinux/config
# disabled - No SELinux policy is loaded.
SELINUX=disabled
- 同步时间 NTP 服务
- 配置系统内核参数
sudo vim /etc/sysctl.conf
#增加以下内容:
kernel.sem = 40960 2048000 40960 20480
#执行生效命令:
sysctl -p
三、创建gbase用户(所有节点)
用户创建
groupadd gbase
useradd -m -d /home/gbase gbase -g gbase
passwd gbase
添加普通用户至 sudoer 列表
root ALL=(ALL) ALL
gbase ALL=(ALL) NOPASSWD:ALL
在所有节点创建 gbase 用户免密登录
mkdir ~/.ssh
chmod 700 ~/.ssh
cd /home/gbase/,ssh
ssh-keygen -t rsa
ssh-copy-id gbase@192.162.168.221
ssh-copy-id gbase@192.162.168.222
ssh-copy-id gbase@192.162.168.223
四、 安装部署,只在node1 安装即可同步
创建数据库目录
登录 gbase 用户
mkdir -p /home/gbase/gbase_db
创建上传目录
mkdir -p /home/gbase/gbase_package
上传文件
上传 GBase8sV8.8_S3.0.0B69_centos7.8_x86_64.tar.gz 到 /home/gbase/gbase_package
解压
cd /home/gbase/gbase_package
tar xvf GBase8sV8.8_S3.0.0B69_centos7.8_x86_64.tar.gz
tar xvf GBase8sV8.8_S3.0.0B69_CentOS_x86_64_om.tar.gz
编辑 yml
cp /home/gbase/gbase_package/gbase.yml /home/gbase/
vim /home/gbase/gbase.yml
//填入以下信息,注意yml格式
gha_server:
- gha_server1:
host: 192.168.162.221
port: 20001
- gha_server2:
host: 192.168.162.222
port: 20001
dcs:
- host: 192.168.162.221
port: 2379
- host: 192.168.162.222
port: 2379
- host: 192.168.162.223
port: 2379
datanode:
- dn1:
- dn1_1:
host: 192.168.162.221
agent_host: 192.168.162.221
role: primary
port: 15432
agent_port: 8005
work_dir: /home/gbase/data/dn1/dn1_1
- dn1_2:
host: 192.168.162.222
agent_host: 192.168.162.222
role: standby
port: 15432
agent_port: 8006
work_dir: /home/gbase/data/dn1/dn1_2
- dn1_3:
host: 192.168.162.223
agent_host: 192.168.162.223
role: standby
port: 15432
agent_port: 8006
work_dir: /home/gbase/data/dn1/dn1_3
env:
# cluster_type allowed values: multiple-nodes, single-inst, default is multiple-nodes
cluster_type: single-inst
pkg_path: /home/gbase/gbase_package
prefix: /home/gbase/gbase_db
version: V8.8_S3.0.0B69
user: gbase
port: 22
third_ssh: false
# constant:
# virtual_ip: 100.0.1.254/24
安装命令
cd /home/gbase/gbase_package/script
./gha_ctl install -p /home/gbase/ -c gbase
查看状态命令
gha_ctl monitor all -l http://192.168.162.221:2379 -
启停数据库
//启动
./gha_ctl start all -l http://192.168.162.221:2379
//停止
./gha_ctl stop all -l http://192.168.162.221:2379
五、数据库卸载
卸载
./gha_ctl uninstall -c gbase8s -l http://192.168.162.221:2379
卸载完成后删除 DCS
./gha_ctl destroy dcs -l http://192.168.162.221:2379
六、数据库连接与使用
本地连接
gsql -d dbname -p port <-U user_name> <-h hostip >
gsql -d postgres -p 15432
修改密码
ALTER ROLE user_name IDENTIFIED BY '新密码'
ALTER ROLE gbase IDENTIFIED BY 'casic@123456'
远程连接
使用 navicat ,创建连接选择 PostGreSQL 配置