安装部署opengauss(单节点,轻简版,非OM方式)

环境:
OS:Centos 7
DB:3.0
Python:3.6.5

 

1.下载安装包
https://opengauss.org/zh/download.html
我这里下载的是openGauss_3.0.0 极简版:
openGauss-3.0.0-CentOS-64bit.tar.bz2


将下载安装包上传到服务器/soft/opangauss目录下
[root@host134 opengauss]# ls -1
openGauss-3.0.0-CentOS-64bit.tar.bz2

 

2.安装依赖包
yum install libaio-devel
yum install flex
yum install bison
yum install ncurses-devel
yum install glibc-devel
yum install patch
yum install redhat-lsb-core
yum install readline-devel


3.创建相关目录,用户,组
root账号下操作
[root@host134 ~]#groupadd dbgrp -g 2000
[root@host134 ~]#useradd omm -g 2000 -u 2000
[root@host134 ~]#echo "oracle" | passwd --stdin omm
[root@host134 ~]#mkdir -p /opt/opengauss/software ##软件安装目录
[root@host134 ~]#mkdir -p /opt/opengauss/data ##数据目录
[root@host134 ~]#chown -R omm:dbgrp /opt/opengauss

 

4.解压二进制文件
[root@host134 opengauss]# pwd
/soft/opengauss
[root@host134 opengauss]# ls -al openGauss-3.0.0-CentOS-64bit.tar.bz2
-rw-r--r-- 1 root root 96246093 Apr 1 18:26 openGauss-3.0.0-CentOS-64bit.tar.bz2


[omm@host134 opengauss]# cd /soft/opengauss
[omm@host134 opengauss]# tar -jxf openGauss-3.0.0-CentOS-64bit.tar.bz2 -C /opt/opengauss/software/

[root@host134 ~]#chown -R omm:dbgrp /opt/opengauss 

 

5.设置用户omm环境变量
su - omm
export GAUSSHOME=/opt/opengauss/software
export PATH=$GAUSSHOME/bin:$PATH
export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH

6.初始化数据库
su - omm
gs_initdb --pgdata=/opt/opengauss/data --nodename=slnngk --encoding=UTF-8 --locale=en_US.UTF-8

参数说明:
--nodename=NODENAME name of single node initialized

 

复制代码
[omm@host134 opengauss]$ gs_initdb --pgdata=/opt/opengauss/data --nodename=slnngk --encoding=UTF-8 --locale=en_US.UTF-8
The files belonging to this database system will be owned by user "omm".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default text search configuration will be set to "english".

fixing permissions on existing directory /opt/opengauss/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
Begin init undo subsystem meta.
[INIT UNDO] Init undo subsystem meta successfully.
creating template1 database in /opt/opengauss/data/base/1 ... The core dump path is an invalid directory
2022-07-19 16:06:46.895 [unknown] [unknown] localhost 140169397201984 0[0:0#0]  [BACKEND] WARNING:  macAddr is 21076/13163551, sysidentifier is 1381236936/3693077650, randomNum is 3762742418
ok
initializing pg_authid ... ok
setting password ... ok
initializing dependencies ... ok
loading PL/pgSQL server-side language ... ok
creating system views ... ok
creating performance views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
initialize global configure for bucketmap length ... ok
creating information schema ... ok
loading foreign-data wrapper for distfs access ... ok
loading foreign-data wrapper for hdfs access ... ok
loading foreign-data wrapper for log access ... ok
loading hstore extension ... ok
loading foreign-data wrapper for MOT access ... ok
loading security plugin ... ok
update system tables ... ok
creating snapshots catalog ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
freezing database template0 ... ok
freezing database template1 ... ok
freezing database postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run gs_initdb.

Success. You can now start the database server of single node using:

    gaussdb -D /opt/opengauss/data --single_node
or
    gs_ctl start -D /opt/opengauss/data -Z single_node -l logfile
复制代码

 

7.修改初始化参数
pg_hba.conf文件
vi /opt/opengauss/data/pg_hba.conf

host all all 0.0.0.0/0 md5

postgresql.conf文件
vi /opt/opengauss/data/postgresql.conf

port=5432
max_connections = 4000
listen_addresses = '*'
password_encryption_type = 0
##log_directory = '/opt/opengauss/pg_log'

 

8.启动数据库
gs_ctl start -D /opt/opengauss/data


9.登陆
gsql -d postgres -p 5432

修改密码
openGauss=# ALTER USER omm WITH PASSWORD 'Gauss@123456';
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
ALTER ROLE

 

10.查看状态

复制代码
[omm@host134 opengauss]$ ps ux | grep gaussdb
omm      19453  3.8  8.3 3831680 1008424 ?     Ssl  16:13   0:05 /opt/opengauss/software/bin/gaussdb -D /opt/opengauss/data
omm      19915  0.0  0.0 110480   908 pts/1    S+   16:15   0:00 grep --color=auto gaussdb
[omm@host134 opengauss]$ gs_ctl query -D /opt/opengauss/data
[2022-07-19 16:15:51.558][19949][][gs_ctl]: gs_ctl query ,datadir is /opt/opengauss/data 
 HA state:           
        local_role                     : Normal
        static_connections             : 0
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
No information 
 Receiver info:      
No information 
复制代码

 

11.创建数据库和用户用户
gsql -d postgres -p 5432

openGauss=# create database db_test with encoding 'utf8' template = template0;
CREATE DATABASE

openGauss=# create user hxl password 'Gauss@123456';
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
CREATE ROLE

openGauss=# grant all privileges to hxl;


12.使用开发用户登陆
[omm@host134 data]$ gsql -U hxl -d db_test -h 127.0.0.1 -p 5432
Password for user hxl:
这里输入密码

db_test=> create table public.tb_test(id number,name varchar(32));
ERROR: permission denied for schema public
DETAIL: N/A

若是没有授予grant all privileges to hxl 权限就会报这个错误

 

posted @   slnngk  阅读(1259)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 【.NET】调用本地 Deepseek 模型
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
历史上的今天:
2021-07-20 ORA-12012: error on auto execute of job "SYS"."ORA$AT_OS_OPT_SY_363"
2021-07-20 mysqldump记录导出的位置
点击右上角即可分享
微信分享提示