暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

在openEuler 22.03系统上使用yum安装openGauss单机环境

DB宝 2022-08-15
1487

详细过程参考: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
9
10docker exec -it lhropeneuler22 bash 
11
12
13[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"
20
21
22
23
24
25yum install -y opengauss
26systemctl status opengauss
27systemctl restart opengauss
28systemctl status opengauss
29
30
31su - opengauss
32-- gs_initdb /var/lib/opengauss/data/ --nodename=lhropeneuler22
33
34
35gs_ctl start
36gs_ctl status
37gs_ctl query
38


复制
296[root@lhropeneuler22 /]# systemctl status opengauss
297○ opengauss.service - Start openGauss server
298     Loaded: loaded (/usr/lib/systemd/system/opengauss.service; enabled; vendor preset: disabled)
299     Active: inactive (dead)
300[root@lhropeneuler22 /]
301[root@lhropeneuler22 /]# systemctl restart opengauss
302[root@lhropeneuler22 /]# systemctl status opengauss 
303● opengauss.service - Start openGauss server
304     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 ago
306    Process: 3362 ExecStart=/usr/local/opengauss/script/autostart.sh (code=exited, status=0/SUCCESS)
307   Main PID: 3362 (code=exited, status=0/SUCCESS)
308
309Apr 12 16:45:14 lhropeneuler22 systemd[1]: Started Start openGauss server.
310Apr 12 16:45:14 lhropeneuler22 su[3363]: (to opengauss) root on none
311Apr 12 16:45:14 lhropeneuler22 su[3363]: pam_unix(su-l:session): session opened for user opengauss(uid=1000by (uid=0)
312Apr 12 16:45:15 lhropeneuler22 su[3363]: pam_unix(su-l:session): session closed for user opengauss
313Apr 12 16:45:15 lhropeneuler22 autostart.sh[3362]: Start openGauss database success.
314[root@lhropeneuler22 /]
315[root@lhropeneuler22 /]# su - opengauss
316Last login: Tue Apr 12 16:45:14 CST 2022
317
318
319Welcome to 3.10.0-1127.10.1.el7.x86_64
320
321System information as of time:  Tue Apr 12 16:45:26 CST 2022
322
323System load:    0.48
324Processes:      34
325Memory used:    3.6%
326Swap used:      0%
327Usage On:       68%
328IP address:     172.17.0.3
329Users online:   0
330To run a command as administrator(user "root"),use "sudo <command>".
331[opengauss@lhropeneuler22 ~]$ 
332[opengauss@lhropeneuler22 ~]$ gs_ctl status
333[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 query
338[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                     : Normal
341        static_connections             : 0
342        db_state                       : Normal
343        detail_information             : Normal
344
345 Senders info:       
346No information 
347 Receiver info:      
348No information 
349[opengauss@lhropeneuler22 ~]$  more /var/lib/opengauss/.bash_profile
350export GAUSSHOME=/usr/local/opengauss/
351export LD_LIBRARY_PATH=/usr/local/opengauss/lib:$LD_LIBRARY_PATH
352export PATH=/usr/local/opengauss/bin:$PATH
353export PGDATA=/var/lib/opengauss/data
354export PORT=7654
355[opengauss@lhropeneuler22 ~]$ 
356[opengauss@lhropeneuler22 ~]$ gsql -d postgres -r
357gsql ((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.
360
361openGauss=# \l
362ERROR:  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 ROLE
366openGauss=
367openGauss=# alter system set password_policy=0;
368ALTER SYSTEM SET
369openGauss=# alter system set password_encryption_type=1;
370ALTER SYSTEM SET
371openGauss=# ALTER ROLE opengauss IDENTIFIED BY 'lhr' REPLACE 'lhr@xxt123';
372NOTICE:  The encrypted password contains MD5 ciphertext, which is not secure.
373ALTER ROLE
374openGauss=# exit
375openGauss-# \q
376[opengauss@lhropeneuler22 ~]$ 
377[opengauss@lhropeneuler22 ~]$ 
378[opengauss@lhropeneuler22 ~]$ cat >> /var/lib/opengauss/data/postgresql.conf <<"EOF"
379> listen_addresses = '*'
380> EOF
381[opengauss@lhropeneuler22 ~]$ 
382[opengauss@lhropeneuler22 ~]$ 
383[opengauss@lhropeneuler22 ~]$ echo "host  all  all  0.0.0.0/0  sha256" >> /var/lib/opengauss/data/pg_hba.conf
384[opengauss@lhropeneuler22 ~]$ 
385[opengauss@lhropeneuler22 ~]$ 
386[opengauss@lhropeneuler22 ~]$ gs_ctl restart
387[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... done
389server stopped
390[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.
392
3930 LOG:  [Alarm Module]Host Name: lhropeneuler22 
394
3950 LOG:  [Alarm Module]Host IP: 172.17.0.3 
396
3970 LOG:  [Alarm Module]Get ENV GS_CLUSTER_NAME failed!
398
3990 LOG:  [Alarm Module]Invalid data in AlarmItem fileRead alarm English name failed! line: 55
400
4010 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 directory
4052022-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.
407
4082022-04-12 16:47:32.341 [unknown] [unknown] localhost 140364734101056 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host Name: lhropeneuler22 
409
4102022-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 
411
4122022-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!
413
4142022-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: 55
415
4162022-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 sockets
4182022-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 MB
4212022-04-12 16:47:32.595 [unknown] [unknown] localhost 140364734101056 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for WAL buffers is: 128 MB
4222022-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 MB
4232022-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 Mbytes
4242022-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: 512
4272022-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" success
4282022-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 = 10
430The core dump path is an invalid directory
4312022-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/A
4352022-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/A
4392022-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.
441
442[2022-04-12 16:47:33.265][3508][][gs_ctl]:  done
443[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 -r
446gsql ((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.
449
450openGauss=
451openGauss=# create user lhr with password 'lhr' sysadmin ;
452NOTICE:  The encrypted password contains MD5 ciphertext, which is not secure.
453CREATE ROLE
454openGauss=
455openGauss=# grant all PRIVILEGES to lhr; 
456ALTER ROLE
457openGauss=# \q
458[opengauss@lhropeneuler22 ~]$ ifconfig
459eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
460        inet 172.17.0.3  netmask 255.255.0.0  broadcast 172.17.255.255
461        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 0
464        TX packets 5384  bytes 332270 (324.4 KiB)
465        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
466
467lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
468        inet 127.0.0.1  netmask 255.0.0.0
469        loop  txqueuelen 1000  (Local Loopback)
470        RX packets 481  bytes 155467 (151.8 KiB)
471        RX errors 0  dropped 0  overruns 0  frame 0
472        TX packets 481  bytes 155467 (151.8 KiB)
473        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
474
475[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.
480
481openGauss=> \l
482                                   List of databases
483   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/opengauss
488 template1 | opengauss | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/opengauss           +
489           |           |          |             |             | opengauss=CTc/opengauss
490(3 rows)
491
492openGauss=> \q
493[opengauss@lhropeneuler22 ~]$ 
494[opengauss@lhropeneuler22 ~]$ gsql -d postgres -U lhr  -W'lhr' -h 192.168.66.35 -p7654 -r
495gsql ((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.
498
499openGauss=> \q

复制

参考

https://www.xmmup.com/tag/opengauss

在Docker中快速体验openGauss数据库

在Docker中快速体验openGauss主备环境数据库

安装openGauss极简版单节点和一主一备节点环境

https://mp.weixin.qq.com/s/sh6GIhTV2V2aaxuZQDoozg


文章转载自DB宝,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论