使用正确的用户 omm
#su - omm
1.操作系统层面查看数据库进程和线程。如果数据库启动,则有相应的进程和线程。
ps -ef|grep gauss
ps -Tp 1
2.使用gs_ctl工具查看数据库状态,如果数据库启动,显示gs_ctl: server is running (PID: 1)
gs_ctl status
3. 查看数据文件的目录的几种方法
gs_ctl notifygrep -i PGDATA ~/.bashrcgsql -r show data_directory ;select setting from pg_settings where name='data_directory';
4.在gsql中查看数据文件的目录、数据库版本
su - omm
gsql -r
show data_directory ;
select version();顺便学习一下gs_ctl参数omm@modb:~$ gs_ctl --help
gs_ctl is a utility to initialize, start, stop, or control a openGauss server.
Usage:
gs_ctl init[db] [-D DATADIR] [-s] [-o "OPTIONS"]
gs_ctl start [-w] [-t SECS] [-D DATADIR] [-s] [-l FILENAME] [-o "OPTIONS"] [-M SERVERMODE]
gs_ctl restart [-w] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]
[-o "OPTIONS"]
gs_ctl build [-D DATADIR] [-b MODE] [-r SECS] [-C CONNECTOR] [-q] [-M SERVERMODE]
gs_ctl stop [-W] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]
gs_ctl reload [-D DATADIR] [-s]
gs_ctl status [-D DATADIR]
gs_ctl finishredo [-D DATADIR] [-s]
gs_ctl failover [-W] [-t SECS] [-D DATADIR] [-U USERNAME] [-P PASSWORD] [-T TERM]
gs_ctl switchover [-W] [-D DATADIR] [-m SWITCHOVER-MODE] [-U USERNAME] [-P PASSWORD] [-f]
gs_ctl query [-D DATADIR] [-U USERNAME] [-P PASSWORD] [-L lsn]
gs_ctl notify -M SERVERMODE [-D DATADIR] [-U USERNAME] [-P PASSWORD]
gs_ctl kill SIGNALNAME PID
gs_ctl querybuild [-D DATADIR]
gs_ctl copy [-D DATADIR] [-Q COPYMODE]
gs_ctl member [-O OPERATION] [-u DCF-NODE-ID] [-i DCF-NODE-IP] [-e DCF-NODE-PORT] [-D PRIMARY-DATADIR]
gs_ctl changerole [-R DCF-ROLE] [-D DATADIR] [-t SEC]
gs_ctl setrunmode [-x XMODE] [-v VOTE-NUM] [-D PRIMARY-DATADIR]
Common options:
-b, --mode=MODE the mode of building the datanode or coordinator.MODE can be "full", "incremental", "auto", "standby_full", "copy_secure_files", "copy_upgrade_file", "cross_cluster_full", "cross_cluster_incremental", "cross_cluster_standby_full"
tart.)
If the -D option is omitted, the environment variable PGDATA is used.
Options for start or restart:
-c, --core-files allow openGauss to produce core files
-l, --log=FILENAME write (or append) server log to FILENAME
-o OPTIONS command line options to pass to openGauss
(openGauss server executable) or gs_initdb
-p PATH-TO-POSTGRES normally not necessary
Options for stop or restart:
-m, --mode=MODE MODE can be "fast" or "immediate"
Options for xlog copy:
-Q, --mode=MODE MODE can be "copy_from_local", "force_copy_from_local", "copy_from_share"
Options for DCF:
-O, --operation=OPERATION Operation of adding or removing or change a DN configuration.
-u, --nodeid=DCF-NODE-ID It is required for member command.
-i, --ip=DCF-NODE-IP It is required when OPERATION of member command is "add".
-e, --port=DCF-NODE-PORT It is required when OPERATION of member command i -D, --pgdata=DATADIR location of the database storage area
-s, --silent only print errors, no informational messages
-t, --timeout=SECS seconds to wait when using -w option
-V, --version output version information, then exit
-w wait until operation completes
-W do not wait until operation completes
-M the database start as the appointed mode
-T Failover requires a term
-q do not start automatically after build finishing, needed start by caller
-d more debug info will be print
-L query lsn:XX/XX validity and show the max_lsn
-P PASSWORD password of account to connect local server
-U USERNAME user name of account to connect local server
-Z NODE-TYPE can be "single_node"
-?, -h, --help show this help, then exit
(The default is to wait for shutdown, start and res change change DCF node configuration.
XMODE are:
minority the leader in DCF can reach consensus when getting less than half nodes' response.
normal the leader in DCF can reach consensus when getting more than half nodes' response.
DCF-NODE-ROLE are:
follower follower role in DCF
passive passive role in DCF
Shutdown modes are:
fast quit directly, with proper shutdown
immediate quit without complete shutdown; will lead to recovery on restart
s "add".
-R, --role=DCF-NODE-ROLE The option is "follower" or "passive".
-v, --votenum=VOTE-NUM It is required when XMODE is "minority".
-x, --xmode=XMODE The option can be "minority" or "normal" mode in DCF.
-G, The option is a int type to set group number in DCF.
--priority, The option is a int type to set priority number in DCF.
OPERATION are:
add add a member to DCF configuration.
remove remove a member from DCF configuration.
Switchover modes are:
-f quit directly, with proper shutdown and do not perform checkpoint
fast demote primary directly, with proper shutdown
SERVERMODE are:
primary database system run as a primary server, send xlog to standby server
standby database system run as a standby server, receive xlog from primary server
cascade_standby database system run as a cascade standby server, receive xlog from standby server
pending database system run as a pending server, wait for promoting to primary or demoting to standby
Only used in start command
Allowed signal names for kill:
ABRT HUP INT QUIT TERM USR1 USR2
Build connection option:
-r, --recvtimeout=INTERVAL time that receiver waits for communication from server (in seconds)
-C, connector CN/DN connect to specified CN/DN for build
Report bugs to openGauss community by raising an issue.
最后修改时间:2022-11-24 11:15:40
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




