详细过程参考:https://www.xmmup.com/zaiopeneuler-22-03caozuoxitongshangshiyongyumanzhuangopengaussdanjihuanjing.html
小麦苗使用yum安装openGauss示例
1-- 直接使用小麦苗定制镜像 2docker rm -f lhropeneuler22 3docker run -itd --name lhropeneuler22 -h lhropeneuler22 \ 4-p 225:22 -p 7654:7654 \ 5--privileged=true \ 6-v /sys/fs/cgroup:/sys/fs/cgroup \ 7lhrbest/openeuler22:1.0 \ 8init 910docker exec -it lhropeneuler22 bash 111213[root@lhropeneuler22 /]# cat /etc/os-release 14NAME="openEuler"15VERSION="22.03 LTS"16ID="openEuler"17VERSION_ID="22.03"18PRETTY_NAME="openEuler 22.03 LTS"19ANSI_COLOR="0;31"202122232425yum install -y opengauss26systemctl status opengauss27systemctl restart opengauss28systemctl status opengauss293031su - opengauss32-- gs_initdb /var/lib/opengauss/data/ --nodename=lhropeneuler22333435gs_ctl start36gs_ctl status37gs_ctl query38
296[root@lhropeneuler22 /]# systemctl status opengauss297○ opengauss.service - Start openGauss server298 Loaded: loaded (/usr/lib/systemd/system/opengauss.service; enabled; vendor preset: disabled)299 Active: inactive (dead)300[root@lhropeneuler22 /]# 301[root@lhropeneuler22 /]# systemctl restart opengauss302[root@lhropeneuler22 /]# systemctl status opengauss 303● opengauss.service - Start openGauss server304 Loaded: loaded (/usr/lib/systemd/system/opengauss.service; enabled; vendor preset: disabled)305 Active: active (exited) since Tue 2022-04-12 16:45:14 CST; 1s ago306 Process: 3362 ExecStart=/usr/local/opengauss/script/autostart.sh (code=exited, status=0/SUCCESS)307 Main PID: 3362 (code=exited, status=0/SUCCESS)308309Apr 12 16:45:14 lhropeneuler22 systemd[1]: Started Start openGauss server.310Apr 12 16:45:14 lhropeneuler22 su[3363]: (to opengauss) root on none311Apr 12 16:45:14 lhropeneuler22 su[3363]: pam_unix(su-l:session): session opened for user opengauss(uid=1000) by (uid=0)312Apr 12 16:45:15 lhropeneuler22 su[3363]: pam_unix(su-l:session): session closed for user opengauss313Apr 12 16:45:15 lhropeneuler22 autostart.sh[3362]: Start openGauss database success.314[root@lhropeneuler22 /]# 315[root@lhropeneuler22 /]# su - opengauss316Last login: Tue Apr 12 16:45:14 CST 2022317318319Welcome to 3.10.0-1127.10.1.el7.x86_64320321System information as of time: Tue Apr 12 16:45:26 CST 2022322323System load: 0.48324Processes: 34325Memory used: 3.6%326Swap used: 0%327Usage On: 68%328IP address: 172.17.0.3329Users online: 0330To run a command as administrator(user "root"),use "sudo <command>".331[opengauss@lhropeneuler22 ~]$ 332[opengauss@lhropeneuler22 ~]$ gs_ctl status333[2022-04-12 16:45:35.496][3484][][gs_ctl]: gs_ctl status,datadir is /var/lib/opengauss/data 334gs_ctl: server is running (PID: 3133)335/usr/local/opengauss/bin/gaussdb "-D" "/var/lib/opengauss/data"336[opengauss@lhropeneuler22 ~]$ 337[opengauss@lhropeneuler22 ~]$ gs_ctl query338[2022-04-12 16:45:43.686][3491][][gs_ctl]: gs_ctl query ,datadir is /var/lib/opengauss/data 339 HA state: 340 local_role : Normal341 static_connections : 0342 db_state : Normal343 detail_information : Normal344345 Senders info: 346No information 347 Receiver info: 348No information 349[opengauss@lhropeneuler22 ~]$ more /var/lib/opengauss/.bash_profile350export GAUSSHOME=/usr/local/opengauss/351export LD_LIBRARY_PATH=/usr/local/opengauss/lib:$LD_LIBRARY_PATH352export PATH=/usr/local/opengauss/bin:$PATH353export PGDATA=/var/lib/opengauss/data354export PORT=7654355[opengauss@lhropeneuler22 ~]$ 356[opengauss@lhropeneuler22 ~]$ gsql -d postgres -r357gsql ((GaussDB Kernel V500R002C00 build ) compiled at 2022-03-30 05:12:20 commit 0 last mr )358Non-SSL connection (SSL connection is recommended when requiring high-security)359Type "help" for help.360361openGauss=# \l362ERROR: Please use "ALTER ROLE user_name PASSWORD 'password';" to set the password of user opengauss before other operation!363openGauss=# 364openGauss=# ALTER ROLE opengauss PASSWORD 'lhr@xxt123';365ALTER ROLE366openGauss=# 367openGauss=# alter system set password_policy=0;368ALTER SYSTEM SET369openGauss=# alter system set password_encryption_type=1;370ALTER SYSTEM SET371openGauss=# ALTER ROLE opengauss IDENTIFIED BY 'lhr' REPLACE 'lhr@xxt123';372NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.373ALTER ROLE374openGauss=# exit375openGauss-# \q376[opengauss@lhropeneuler22 ~]$ 377[opengauss@lhropeneuler22 ~]$ 378[opengauss@lhropeneuler22 ~]$ cat >> /var/lib/opengauss/data/postgresql.conf <<"EOF"379> listen_addresses = '*'380> EOF381[opengauss@lhropeneuler22 ~]$ 382[opengauss@lhropeneuler22 ~]$ 383[opengauss@lhropeneuler22 ~]$ echo "host all all 0.0.0.0/0 sha256" >> /var/lib/opengauss/data/pg_hba.conf384[opengauss@lhropeneuler22 ~]$ 385[opengauss@lhropeneuler22 ~]$ 386[opengauss@lhropeneuler22 ~]$ gs_ctl restart387[2022-04-12 16:47:25.231][3508][][gs_ctl]: gs_ctl restarted ,datadir is /var/lib/opengauss/data 388waiting for server to shut down... done389server stopped390[2022-04-12 16:47:32.254][3508][][gs_ctl]: waiting for server to start...391.0 LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.3923930 LOG: [Alarm Module]Host Name: lhropeneuler22 3943950 LOG: [Alarm Module]Host IP: 172.17.0.3 3963970 LOG: [Alarm Module]Get ENV GS_CLUSTER_NAME failed!3983990 LOG: [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 554004010 WARNING: failed to open feature control file, please check whether it exists: FileName=gaussdb.version, Errno=2, Errmessage=No such file or directory.4020 WARNING: failed to parse feature control file: gaussdb.version.4030 WARNING: Failed to load the product control file, so gaussdb cannot distinguish product version.404The core dump path is an invalid directory4052022-04-12 16:47:32.341 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: when starting as multi_standby mode, we couldn't support data replicaton.4062022-04-12 16:47:32.341 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.4074082022-04-12 16:47:32.341 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Host Name: lhropeneuler22 4094102022-04-12 16:47:32.341 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Host IP: 172.17.0.3 4114122022-04-12 16:47:32.341 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Get ENV GS_CLUSTER_NAME failed!4134142022-04-12 16:47:32.341 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 554154162022-04-12 16:47:32.556 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: loaded library "security_plugin"4172022-04-12 16:47:32.557 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets4182022-04-12 16:47:32.594 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] WARNING: No explicit IP is configured for listen_addresses GUC.4192022-04-12 16:47:32.594 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.4202022-04-12 16:47:32.595 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: reserved memory for backend threads is: 220 MB4212022-04-12 16:47:32.595 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: reserved memory for WAL buffers is: 128 MB4222022-04-12 16:47:32.595 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: Set max backend reserve memory is: 348 MB, max dynamic memory is: 11873 MB4232022-04-12 16:47:32.595 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: shared memory 50 Mbytes, memory context 12221 Mbytes, max process memory 12288 Mbytes4242022-04-12 16:47:32.622 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [CACHE] LOG: set data cache size(12582912)4252022-04-12 16:47:32.623 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [CACHE] LOG: set metadata cache size(4194304)4262022-04-12 16:47:32.666 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [SEGMENT_PAGE] LOG: Segment-page constants: DF_MAP_SIZE: 8156, DF_MAP_BIT_CNT: 65248, DF_MAP_GROUP_EXTENTS: 4175872, IPBLOCK_SIZE: 8168, EXTENTS_PER_IPBLOCK: 1021, IPBLOCK_GROUP_SIZE: 4090, BMT_HEADER_LEVEL0_TOTAL_PAGES: 8323072, BktMapEntryNumberPerBlock: 2038, BktMapBlockNumber: 25, BktBitMaxMapCnt: 5124272022-04-12 16:47:32.708 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: gaussdb: fsync file "/var/lib/opengauss/data/gaussdb.state.temp" success4282022-04-12 16:47:32.708 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: create gaussdb state file success: db state(STARTING_STATE), server mode(Normal)4292022-04-12 16:47:32.732 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: max_safe_fds = 980, usable_fds = 1000, already_open = 10430The core dump path is an invalid directory4312022-04-12 16:47:32.738 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: the configure file /usr/local/opengauss/etc/gscgroup_opengauss.cfg doesn't exist or the size of configure file has changed. Please create it by root user!4322022-04-12 16:47:32.739 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [BACKEND] LOG: Failed to parse cgroup config file.4332022-04-12 16:47:32.745 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [EXECUTOR] WARNING: Failed to obtain environment value $GAUSSLOG!4342022-04-12 16:47:32.745 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [EXECUTOR] DETAIL: N/A4352022-04-12 16:47:32.745 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [EXECUTOR] CAUSE: Incorrect environment value.4362022-04-12 16:47:32.745 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.4372022-04-12 16:47:32.746 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [EXECUTOR] WARNING: Failed to obtain environment value $GAUSSLOG!4382022-04-12 16:47:32.746 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [EXECUTOR] DETAIL: N/A4392022-04-12 16:47:32.746 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [EXECUTOR] CAUSE: Incorrect environment value.4402022-04-12 16:47:32.746 [unknown] [unknown] localhost 140364734101056 0[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.441442[2022-04-12 16:47:33.265][3508][][gs_ctl]: done443[2022-04-12 16:47:33.265][3508][][gs_ctl]: server started (/var/lib/opengauss/data)444[opengauss@lhropeneuler22 ~]$ 445[opengauss@lhropeneuler22 ~]$ gsql -d postgres -r446gsql ((GaussDB Kernel V500R002C00 build ) compiled at 2022-03-30 05:12:20 commit 0 last mr )447Non-SSL connection (SSL connection is recommended when requiring high-security)448Type "help" for help.449450openGauss=# 451openGauss=# create user lhr with password 'lhr' sysadmin ;452NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.453CREATE ROLE454openGauss=# 455openGauss=# grant all PRIVILEGES to lhr; 456ALTER ROLE457openGauss=# \q458[opengauss@lhropeneuler22 ~]$ ifconfig459eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500460 inet 172.17.0.3 netmask 255.255.0.0 broadcast 172.17.255.255461 ether 02:42:ac:11:00:03 txqueuelen 0 (Ethernet)462 RX packets 5739 bytes 38912047 (37.1 MiB)463 RX errors 0 dropped 0 overruns 0 frame 0464 TX packets 5384 bytes 332270 (324.4 KiB)465 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0466467lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536468 inet 127.0.0.1 netmask 255.0.0.0469 loop txqueuelen 1000 (Local Loopback)470 RX packets 481 bytes 155467 (151.8 KiB)471 RX errors 0 dropped 0 overruns 0 frame 0472 TX packets 481 bytes 155467 (151.8 KiB)473 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0474475[opengauss@lhropeneuler22 ~]$ 476[opengauss@lhropeneuler22 ~]$ gsql -dpostgres -h172.17.0.3 -Ulhr -r -W'lhr'477gsql ((GaussDB Kernel V500R002C00 build ) compiled at 2022-03-30 05:12:20 commit 0 last mr )478Non-SSL connection (SSL connection is recommended when requiring high-security)479Type "help" for help.480481openGauss=> \l482 List of databases483 Name | Owner | Encoding | Collate | Ctype | Access privileges 484-----------+-----------+----------+-------------+-------------+-------------------------485 postgres | opengauss | UTF8 | en_US.UTF-8 | en_US.UTF-8 | 486 template0 | opengauss | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/opengauss +487 | | | | | opengauss=CTc/opengauss488 template1 | opengauss | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/opengauss +489 | | | | | opengauss=CTc/opengauss490(3 rows)491492openGauss=> \q493[opengauss@lhropeneuler22 ~]$ 494[opengauss@lhropeneuler22 ~]$ gsql -d postgres -U lhr -W'lhr' -h 192.168.66.35 -p7654 -r495gsql ((GaussDB Kernel V500R002C00 build ) compiled at 2022-03-30 05:12:20 commit 0 last mr )496Non-SSL connection (SSL connection is recommended when requiring high-security)497Type "help" for help.498499openGauss=> \q
参考
https://www.xmmup.com/tag/opengauss
在Docker中快速体验openGauss数据库
在Docker中快速体验openGauss主备环境数据库
安装openGauss极简版单节点和一主一备节点环境
https://mp.weixin.qq.com/s/sh6GIhTV2V2aaxuZQDoozg
文章转载自DB宝,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




