[root@worker1 soft]# lsopenGauss-6.0.0-RC1-CentOS-64bit.tar.bz2[root@worker1 soft]#
3、系统环境配置3.1 目前仅支持在防火墙关闭的状态下进行安装[root@worker1 soft]# sestatusSELinux status: disabled[root@worker1 soft]# [root@worker1 soft]# systemctl status firewalld● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1)[root@worker1 soft]#
3.2 设置字符集参数将各数据库节点的字符集设置为相同的字符集,可以在/etc/profile文件中添加“export LANG=XXX”(XXX为Unicode编码)en_US.UTF-8[root@worker1 soft]# echo 'export LANG=en_US.UTF-8' >>/etc/profile[root@worker1 soft]#
3.3 关闭RemoveIPC在各数据库节点上,关闭RemoveIPCCentOS操作系统默认为关闭,可以跳过该步骤、RemoveIPC=no3.4 关闭HISTORY记录HISTSIZE=04、创建用户和组4.1 创建用户组dbgroup[root@worker1 ~]# [root@worker1 ~]# groupadd dbgroup[root@worker1 ~]#
4.2 创建用户组dbgroup下的普通用户omm,并设置普通用户omm的密码[root@worker1 ~]# useradd -g dbgroup omm[root@worker1 ~]# passwd ommChanging password for user omm.New password: Retype new password: passwd: all authentication tokens updated successfully.[root@worker1 ~]#
四、单节点安装前提条件已完成用户组和普通用户的创建所有服务器操作系统和网络均正常运行普通用户必须有数据库包解压路径、安装路径的读、写和执行操作权限,并且安装路径必须为空普通用户对下载的openGauss压缩包有执行权限安装前请检查指定的openGauss端口是否被占用,如果被占用请更改端口或者停止当前使用端口进程1、用户登录使用普通用户登录到openGauss包安装的主机,解压openGauss压缩包到安装目录(假定安装目录为/opt/software/openGauss,请用实际值替换)[root@worker1 soft]# lsopenGauss-6.0.0-RC1-CentOS-64bit.tar.bz2[root@worker1 soft]# tar -jxf openGauss-6.0.0-RC1-CentOS-64bit.tar.bz2 -C /opt/software/openGauss/[root@worker1 soft]#
如果报错没有权限[omm@worker1 soft]$ tar -jxf openGauss-6.0.0-RC1-CentOS-64bit.tar.bz2 -C /opt/software/openGauss/tar: ./bin: Cannot mkdir: Permission deniedtar: ./bin: Cannot mkdir: Permission denied
切换为root用户后添加权限就可以了[root@worker1 opt]# chown omm:dbgroup /opt/software/openGauss/[root@worker1 opt]# chmod 755 /opt/software/openGauss/
2、解压假定解压包的路径为/opt/software/openGauss,进入解压后目录下的simpleInstall[root@worker1 soft]# cd /opt/software/openGauss/simpleInstall[root@worker1 simpleInstall]# lsfinance.sql install.sh README.md school.sql[root@worker1 simpleInstall]#
3、脚本安装执行install.sh脚本安装openGauss[root@worker1 simpleInstall]# sh install.sh -w "openGauss666" &&source ~/.bashrc[step 1]: check parameterError: can not install openGauss with root[root@worker1 simpleInstall]#
安装报错[omm@worker1 simpleInstall]$ sh install.sh -w "openGauss666" &&source ~/.bashrc[step 1]: check parameter[step 2]: check install env and os settingOn systemwide basis, the maximum number of SEMMNI is not correct. the current SEMMNI value is: 128. Please check it.The required value should be greater than 321. You can modify it in file '/etc/sysctl.conf'.[omm@worker1 simpleInstall]$
解决办法:用root登录修改所需的值应大于321,然后执行sysctl -p[root@worker1 ~]# [root@worker1 ~]# sysctl -w kernel.sem="250 85000 250 330" kernel.sem = 250 85000 250 330[root@worker1 ~]#
再次执行install.sh脚本安装openGauss[omm@worker1 simpleInstall]$ sh install.sh -w "openGauss666" &&source ~/.bashrc[2024-05-17 16:39:10.010][7802][][gs_ctl]: done[2024-05-17 16:39:10.010][7802][][gs_ctl]: server started (/opt/software/openGauss/data/single_node)import sql fileWould you like to create a demo database (yes/no)?
4、完成安装5、检查安装进程安装执行完成后,使用ps和gs_ctl查看进程是否正常[omm@worker1 simpleInstall]$ [omm@worker1 simpleInstall]$ ps ux | grep gaussdbomm 7805 2.2 2.8 6267816 922936 ? Ssl 16:39 0:04 /opt/software/openGauss/bin/gaussdb -D /opt/software/openGauss/data/single_nodeomm 8180 0.0 0.0 110480 908 pts/0 S+ 16:42 0:00 grep --color=auto gaussdb[omm@worker1 simpleInstall]$
ps ux | grep gaussdbgs_ctl query -D /opt/software/openGauss/data/single_node
5.1 执行ps命令,显示类似如下信息:omm 20377 0.0 0.0 119880 1216 pts/0 S+ 15:37 0:00 grep --color=auto gaussdb
5.2 执行gs_ctl命令,显示类似如下信息: HA state: local_role : Normalstatic_connections : 0db_state : Normaldetail_information : Normal Senders info: No information Receiver info: No information [omm@worker1 simpleInstall]$
五、数据库的增删改查1、连接本地连接数据库gsql ((openGauss 6.0.0-RC1 build ed7f8e37) compiled at 2024-03-31 11:59:31 commit 0 last mr )Non-SSL connection (SSL connection is recommended when requiring high-security)Type "help" for help.openGauss=#
登录端口可以查看 postgresql.conf文件[omm@worker1 single_node]$ cat postgresql.conf |grep portport = 5432# (change requires restart)#ssl_renegotiation_limit = 0# amount of data between renegotiations, no longer supported# supported by the operating system:
2、创建数据库数据库安装完成后,默认生成名称为postgres的数据库您需要自己创建一个新的数据库openGauss=# CREATE DATABASE database_openGauss;CREATE DATABASEopenGauss=#
3、查看数据库3.1 使用“\l”用于查看已经存在的数据库\lopenGauss=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges --------------------+-------+----------+-------------+-------------+------------------- database_opengauss | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | finance | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | school | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm + | | | | | omm=CTc/omm template1 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm + | | | | | omm=CTc/omm(6 rows)openGauss=#
3.2 使用 “\c + 数据库名” 进入已存在数据库openGauss=# openGauss=# \c database_opengaussNon-SSL connection (SSL connection is recommended when requiring high-security)You are now connected to database "database_opengauss" as user "omm".database_opengauss=#
4、修改数据库ALTER DATABASE database_opengauss RENAME TO new_name666;openGauss=# ALTER DATABASE database_opengauss RENAME TO new_name666;ALTER DATABASEopenGauss=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -------------+-------+----------+-------------+-------------+------------------- finance | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | new_name666 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | school | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm + | | | | | omm=CTc/omm template1 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm + | | | | | omm=CTc/omm(6 rows)openGauss=#
5、删除数据库openGauss=# DROP DATABASE new_name666 ;DROP DATABASEopenGauss=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+-------+----------+-------------+-------------+------------------- finance | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | school | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm + | | | | | omm=CTc/omm template1 | omm | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/omm + | | | | | omm=CTc/omm(5 rows)openGauss=#
总结openGauss 6.0.0版本在安装和使用方面都带来了很大的改进和优化一站式交互安装功能极大地简化了安装流程,降低了用户的学习成本;性能优化和中文日志支持功能则进一步提升了数据库的稳定性和易用性通过实际测试,我认为openGauss 6.0.0版本是一款非常优秀的国产数据库产品,值得广大用户尝试和使用关注#华为云开发者联盟#点击下方,第一时间了解华为云新鲜技术~华为云博客_大数据博客_AI博客_云计算博客_开发者中心-华为云(图片来源网络,侵删)
0 评论