openGauss 官网  
openGauss 下载地址

支持的操作系统
● ARM:
  ● openEuler 20.03LTS(推荐采用此操作系统)
  ● 麒麟V10
  ● Asianux 7.5
● X86:
  ● openEuler 20.03LTS
  ● CentOS 7.6
  ● Asianux 7.6

准备软硬件安装环境
# Step 1: 新建用户组、用户

groupadd dbgroup
useradd -g dbgroup omm
passwd omm
新密码:abcd@123456

# Step 2: 创建文件夹

mkdir -p /opt/software/openGauss
chown 755 -R /opt/software
chown -R omm /opt/software/openGauss

# Step 3: 下载安装包
下载地址:https://opengauss.org/zh/download
下载【openGauss_3.1.0 极简版】
把下载文件【openGauss-3.1.0-CentOS-64bit.tar.bz2】拷贝到【/opt/software/openGauss】目录

# Step 4: 关闭防火墙

systemctl disable firewalld.service
systemctl stop firewalld.service

# Step 5: 查看python版本

python -V

# Step 6: 关闭 selinux,目前仅支持在防火墙关闭的状态下进行安装

# 将 SELINUX=enforcing 改为 SELINUX=disabled
vim /etc/selinux/config
SELINUX=disabled

# Step 7: 关闭HISTORY记录

vim /etc/profile
HISTSIZE=0
source /etc/profile

# Step 8: 将交换内存关闭

swapoff -a

# Step 9: 关闭RemoveIPC【可以跳过】

vim  /etc/systemd/logind.conf
RemoveIPC=novim /usr/lib/systemd/system/systemd-logind.service
RemoveIPC=no#重新加载配置参数
systemctl daemon-reload
systemctl restart systemd-logind#检查修改是否生效
loginctl show-session | grep RemoveIPC
systemctl show systemd-logind | grep RemoveIPC

# Step 10: 设置字符集参数

cat /etc/profile
vim /etc/profile
LANG=en_US.UTF-8# 重新加载 etc/profile
source /etc/profile

# Step 11: 重启操作系统

reboot

# Step 12: 切换omm用户

su omm

# Step 13: 解压安装包

cd /opt/software/openGauss
tar -jxf openGauss-3.1.0-CentOS-64bit.tar.bz2 -C /opt/software/openGauss
ls -lb

# Step 14: 使用有root权限的用户执行命令

# 不执行,可能出现错误提示
# the maximum number of SEMMNI is not correct, the current SEMMNI is xxx. Please check it.
cat /etc/sysctl.conf
sysctl -w kernel.sem="250 85000 250 330" 

# Step 15: 一键式脚本安装,一定要切换到 omm 用户

# 跳转目录simpleInstall
cd /opt/software/openGauss/simpleInstall
ls -l#执行install.sh脚本安装openGauss
sh install.sh -w Gauss$123456 ~/.bashrc# 提示:Would you like to create a demo database (yes/no)?
# 输入【yes】#参数说明
-w:初始化数据库密码(gs_initdb指定),安全需要必须设置。
-p:指定的openGauss端口号,如不指定,默认为5432。
-h|–help:打印使用说明。
安装后,该数据库部署结点的名称为sgnode(gs_initdb指定)。# 恭喜你,基本安装成功了
Load demoDB [school,finance] success.
[complete successfully]: You can start or stop the database server using:gs_ctl start|stop|restart -D $GAUSSHOME/data/single_node -Z single_node# 说明
openGauss端口号默认为5432
默认生成名称为postgres的数据库
数据库目录安装路径/opt/software/openGauss/data/single_node,其中/opt/software/openGauss为解压包路径,data/single_node为新创建的数据库节点目录。# 执行ps命令,查看进程是否正常
ps ux | grep gaussdb# 提示如下,安装成功
omm       23246  1.3 17.5 2841700 678364 ?      Ssl  10:59   0:07 /opt/software/openGauss/bin/gaussdb -D /opt/software/openGauss/data/single_node
omm       79232  0.0  0.0 112724   984 pts/1    S+   11:08   0:00 grep --color=auto gaussdb# 执行gs_ctl命令,查看进程是否正常,如果没有找到 gs_ctl
# 解决方式1:配置环境变量即可 export PATH=/opt/software/openGauss/bin:$PATH,如果缺失lib则配置LD_LIBRARY_PATH
# 解决方式2:
cd /opt/software/openGauss/bin
ll#先切换到【root】用户,再切换到【omm】用户,再执行如下命令
gs_ctl query -D /opt/software/openGauss/data/single_node【ok】
gs_ctl query -D /opt/software/openGauss/data/single_node -Z single_node【ok】
/opt/software/openGauss/bin/gs_ctl query -D /opt/software/openGauss/data/single_node【ok】#启动
gs_ctl start -D /opt/software/openGauss/data/single_node -Z single_node#停止
gs_ctl stop -D /opt/software/openGauss/data/single_node -Z single_node#重启
gs_ctl restart -D /opt/software/openGauss/data/single_node -Z single_node# openGauss重启
gs_ctl restart -D /opt/software/openGauss/data/single_node#查看数据库主节点的端口号
cat /opt/software/openGauss/data/single_node/postgresql.conf | grep port
cat /opt/software/openGauss/data/master/postgresql.conf |grep port
cat /opt/software/openGauss/data/slave/postgresql.conf |grep port

##########################################
#                         gsql 连接与使用方法                      #
##########################################
#查询所有的数据库,需要先切换omm用户,su omm

[omm@localhost /]$ gsql -d postgres -p 5432 -l【success,默认omm用户】

# Step 1: 连接数据库,链接数据库

[omm@localhost /]$ gsql -d postgres -p 5432
[omm@localhost /]$ gsql -d postgres -p 5432 -r
[omm@localhost /]$ gsql -d postgres -U omm -p 5432 【无须输入密码,Gauss$123456】
[omm@localhost /]$ gsql -d postgres -U jim -p 5432 -W Bigdata@123【success】
[omm@localhost /]$ gsql -d postgres -h localhost -U zhangsan -p 5432 -W Gauss123456$【success】
[omm@localhost /]$ gsql -d db_test -U zhangsan -p 5432 -W Gauss123456$【success】
[omm@localhost /]$ gsql -d db_test -h 192.168.176.131 -U zhangsan -p 5432 -W Gauss123456$【fail】

# 创建用户
# Step 2: 创建用户,注意加分号

     # 语法:create user 用户名 with password "密码";
openGauss=# create user zhangsan with password "Gauss123456$";
openGauss=# create user zhaoliu with password 'Gauss123456$';
openGauss=# CREATE USER lisi WITH PASSWORD 'Gauss123456$';
openGauss=# CREATE USER jim CREATEDB PASSWORD 'Gauss123456$';  #创建有“创建数据库”权限的用户,则需要加CREATEDB关键字。# 将sysadmin权限授权给zhangsan,授权成功后,用户zhangsan会拥有sysadmin的所有权限
openGauss=# GRANT ALL PRIVILEGES TO zhangsan;

# Step 3: 查看数据库用户列表

openGauss=# select * from pg_user;

# 查看所有角色

openGauss=# select * from PG_ROLES;

# 删除数据库用户,注意加分号

openGauss=# drop user zhangsan cascade;
openGauss=# drop user lisi cascade;

# 创建数据库,并指定所有者owner,注意加分号

       语法:create database 数据库名 owner 用户名;
openGauss=# create database db_test owner zhangsan;
openGauss=# create database db_test owner lisi;
openGauss=# create database db_sc with tablespace = tpcds_local;

# 删除数据库,注意加分号

       语法:drop database 数据库名;
openGauss=# drop database db_test;

# 创建表

# 语法
CREATE TABLE warehouse_t0
(W_WAREHOUSE_NAME VARCHAR(20) ,W_ZIP CHAR(10)
);openGauss=# \c db_test;db_test=# CREATE TABLE warehouse_t1 (W_WAREHOUSE_NAME VARCHAR(20),W_ZIP CHAR(10));
db_test=# CREATE TABLE warehouse_t2 (W_WAREHOUSE_NAME VARCHAR(20),W_ZIP CHAR(10));
db_test=# CREATE TABLE warehouse_t3 (W_WAREHOUSE_NAME VARCHAR(20),W_ZIP CHAR(10));
db_test=# CREATE TABLE warehouse_t4 (W_WAREHOUSE_NAME VARCHAR(20));
db_test=# CREATE TABLE warehouse_t0
db_test-# (
db_test(#   W_WAREHOUSE_NAME VARCHAR(20) ,
db_test(#   W_ZIP CHAR(10)
db_test(# );db_test=#  \dt;

# Step 4: 查看对象

openGauss=# \l            #查看数据库
openGauss=# \c school     #查看数据库
openGauss=# \dt           #查看数据库所有表名
openGauss=# \d student    #查看表结构
openGauss=# \d+ student   #查看表结构

# 使用[【\c + 数据库名】进入已存在数据库

openGauss=# \c school

# Step 5: 退出

openGauss=# \du

# 修改密码

# 将用户jim的登录密码由Bigdata@123修改为Abcd@123。
postgres=# ALTER USER 用户名 IDENTIFIED BY '新密码' REPLACE '旧密码';
postgres=# ALTER USER lisi IDENTIFIED BY 'Gauss123456$' REPLACE 'Gauss123456';
postgres=# ALTER USER jim IDENTIFIED BY 'Abcd@123' REPLACE 'Bigdata@123';
alter user <用户名> identified by '密码';

#切换用户

postgres=# \c 用户名

#退出数据库

postgres=# \q

# 插入 school 数据库 student 表数据,注意加分号

school=# insert into student() values();

# 查询 school 数据库 student 表数据,注意加分号

school=# select * from student;
school=# select * from student where std_name like '%张%';

# 删除 school 数据库 student 表数据,注意加分号

school=# DELETE FROM student where std_id = 100000;

# 删除 school 数据库 student 表数据,注意加分号

school=# DROP TABLE student;

# 配置外网访问
# 配置远程连接
# 配置允许远程连接,切换omm用户,su - omm

# Step 1: 文件 pg_hba.conf 修改
vim /opt/software/openGauss/data/single_node/pg_hba.conf
# 允许所有网段连接 在IPv4 local connections下添加
host  all    all    0.0.0.0/0    sha256
host  all    all    0.0.0.0/0    md5# Step 2: 重新加载 gs_ctl 策略
su omm
cd /opt/software/openGauss/bin
gs_ctl reload -D /opt/software/openGauss/data/single_node# Step 3: 文件 postgresql.conf 修改
vim /opt/software/openGauss/data/single_node/postgresql.conf
# 输入【/】搜索 listen_addresses 变量,将前面#去掉
listen_addresses = '*'
# 输入【/】搜索 password_encryption_type 变量,将前面#去掉
password_encryption_type  = 1# Step 4: 重启数据库
su omm
cd /opt/software/openGauss/bin
gs_ctl restart -D  /opt/software/openGauss/data/single_node

##########################################
#                               DataStudio                               #
##########################################
# 使用 DataStudio 客户端连接 openGauss
远程连接主机地址:192.168.159.130
远程连接端口号:5432
数据库:postgres
用户名:lisi
密码:Gauss123456$
##########################################
#                                    .NET                                   #
##########################################
C# 采用 Npgsql 访问openGauss,因为 Npgsql 不支持 sha256 加密,所以将服务器端的认证加密更改为md5,如果改成MD5加密,Data Studio管理工具无法连接。首先设置 pg_hba.conf 和 postgresql.conf 文件,修改 postgresql.conf 文件,将 password_encryption_type 修改为1,同时支持 sha256 和 md5,然后修改数据库用户密码,这样密码才会存储为 sha256 和 md5 加密的字符串。

# Step 2: 修改配置文件
vim /opt/software/openGauss/data/single_node/postgresql.conf
# 输入【/】搜索 password_encryption_type 变量,将前面#去掉
password_encryption_type  = 1# Step 3: 修改数据库用户密码
postgres=# ALTER USER 用户名 IDENTIFIED BY '新密码' REPLACE '旧密码';
postgres=# ALTER USER lisi IDENTIFIED BY 'Abcd1234@' REPLACE 'Abcd1234$';

##########################################
#                                常见问题                                 #
##########################################
42501: permission denied for relation student DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information."
*
*
*

openGauss 极简版安装相关推荐

  1. centOS系统下openGauss极简版安装

    安装环境准备: 提示:因为openGauss没有提供ubuntu和windows安装包,所以选择安装在centOS 前提条件: 1.已完成用户组和普通用户的创建. 2.所有服务器操作系统和网络均正常运 ...

  2. Atlas 200 DK开发者套件环境部署(1.0.9.alpha)极简版

    Atlas 200 DK开发者套件环境部署(1.0.9.alpha)极简版 前言 Atlas 200 DK开发者套件介绍 环境部署介绍 资源要求 开发环境部署 安装Docker 获取镜像(两种方法任选 ...

  3. 7句话让Codex给我做了个小游戏,还是极简版塞尔达,一玩简直停不下来

    点击上方"视学算法",选择加"星标"或"置顶" 重磅干货,第一时间送达 梦晨 萧箫 发自 凹非寺 量子位 | 公众号 QbitAI 什么,7 ...

  4. 10分钟手撸极简版ORM框架!

    最近很多小伙伴对ORM框架的实现很感兴趣,不少读者在冰河的微信上问:冰河,你知道ORM框架是如何实现的吗?比如像MyBatis和Hibernte这种ORM框架,它们是如何实现的呢? 为了能够让小伙伴们 ...

  5. 美团推出极简版 为用户提供“米面粮油”等生活用品采购服务

    近日,有用户反馈,安卓应用商店显示,美团更新推出了极简版,对主应用的功能进行了删减,保留了美团主应用中涉及生活用品采购的相关业务.用户在打开极简版后,首页会呈现出采购蔬果.米面水油等生活用品的购买入口 ...

  6. python3web库_基于 Python3 写的极简版 webserver

    基于 Python3 写的极简版 webserver.用于学习 HTTP协议,及 WEB服务器 工作原理.笔者对 WEB服务器 的工作原理理解的比较粗浅,仅是基于个人的理解来写的,存在很多不足和漏洞, ...

  7. Underscore源码阅读极简版入门

    看了网上的一些资料,发现大家都写得太复杂,让新手难以入门.于是写了这个极简版的Underscore源码阅读. 源码: github.com/hanzichi/un- 一.架构的实现 1.1:架构 (f ...

  8. 《重大人生启示录》极简版

    <重大人生启示录>极简版 献给所有活着和将要死去的人们,献给所有历经悲伤的人们 本文摘录了启示录最重要的内容,不必非要看全本,不必购买书 序言 这是极为特殊的历史转折期,物质文明发展到这一 ...

  9. 【极简版GH60】【GH60剖析】【六】修改配列

    说完了GH60的硬件部分,接下来到软件部分,我觉得,软件部分才是极简版GH60的精髓部分,毕竟仅有硬件的话GH60只是一个有手感可以按动的一堆没有功能的按键,而软件让他变成了灵活多变的键盘.通过对软件 ...

最新文章

  1. 依那西普速诱导RA快速缓解预示临床和放射学持久缓解
  2. 用js操作table、tr、td 「字体样式及TD背景图片」
  3. 《SolidWorks 2017中文版机械设计从入门到精通)》——2.6 几何关系
  4. 永磁直驱风力发电机结构图_风机越来越大,国内首台10兆瓦海上风力发电机研制成功...
  5. eclipse 关闭时progress information弹框_Spring开发环境搭建(Eclipse)
  6. php用wordanalysis抓取姓名_利用vba查询/抓取 外部数据
  7. 人脸识别错误代码437是什么意思_lol手游repeat ready check fails什么意思 解决攻略大全...
  8. 中文论文万能句型_收藏 | SCI 论文写作的万能句型(二)
  9. [PyTorch] 矩阵乘法
  10. dz email地址无效_Zcash屏蔽地址漏洞或揭示全节点IP地址(附解决方案)
  11. Cocos2d-html5 2.2.2的屏幕适配方案
  12. 【Spring-AOP】底层类ProxyConfig,ProxyProcessorSupport分析
  13. C#导入有道词典单词本到扇贝
  14. 密度聚类算法python详解_密度聚类python
  15. 通过u盘启动计算机使用ghost安装系统步骤,详细教您如何使用u盘启动盘手动ghost备份系统...
  16. 一英寸芯片大小_晶圆和芯片的关系_一个芯片有多少晶圆
  17. 分享十一个学习css的小游戏,快来下载吧!
  18. 破解水卡教程 超详细
  19. 腾讯可信区块链方案白皮书 QA
  20. EF框架(一)搭建过程

热门文章

  1. 应用fiddler,使用har2case 将api参数转成yaml格式
  2. python 两个等长list的各对应位置元素相加+两个字典相加,相同键元素累加,不同键元素取全集
  3. 知名云计算厂商云宏加入龙蜥社区,共同打造信息安全坚实“地基”
  4. 这些数据合并的神操作,你掌握几个?
  5. Ubuntu 17.04下安装64位谷歌Chrome浏览器
  6. 绘画板 java_非常值得学习的java 绘图板源代码
  7. 手机淘宝构架演化实践及优化,天猫,淘宝服务
  8. Value did not match schema:\n1. return.ok.Ok2: Invalid type. Expected: array, given: null
  9. RMM Level -- 对于REST的层级划分模型
  10. 【电脑问题】win10系统