Centos7下systemctl status postgresql 命令相关研究
来源:互联网 发布:延保服务 知乎 编辑:程序博客网 时间:2024/06/09 20:01
postgres有源码安装,yum安装,或者下载包自己rpm,安装方法众多。
以前一台yum安装postgres的机器设置了
systemctl enable postgresql这样postgresql就可以开机自启动了。
我测试了源码安装,并不支持这个命令。
可见,yum安装包偷偷的对systemctl命令进行了一些注册相关的操作?
那么研究一下,执行
[root@db222 ~]# systemctl status postgresql postgresql.service - PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled) Active: active (running) since Fri 2015-06-19 10:19:23 CST; 3 days ago Process: 1104 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=0/SUCCESS) Process: 1068 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS) Main PID: 1153 (postgres) CGroup: /system.slice/postgresql.service ├─1153 /usr/bin/postgres -D /var/lib/pgsql/data -p 5432 ├─2192 postgres: logger process ├─2202 postgres: checkpointer process ├─2203 postgres: writer process ├─2204 postgres: wal writer process ├─2205 postgres: autovacuum launcher process └─2206 postgres: stats collector process Jun 19 10:19:20 db222 systemd[1]: Starting PostgreSQL database server...Jun 19 10:19:20 db222 pg_ctl[1104]: pg_ctl: another server might be running; tryi...wayJun 19 10:19:23 db222 systemd[1]: Started PostgreSQL database server.Hint: Some lines were ellipsized, use -l to show in full.
去/etc/init.d找了一圈没发现和postgres相关的设置,回归本质才发现
注意这行
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled)
我们去里面看看
[root@db222 ~]# less -MN /usr/lib/systemd/system/postgresql.service 26 [Unit] 27 Description=PostgreSQL database server 28 After=network.target 29 30 [Service] 31 Type=forking 32 33 User=postgres 34 Group=postgres 35 36 # Port number for server to listen on 37 Environment=PGPORT=5432 38 39 # Location of database directory 40 Environment=PGDATA=/var/lib/pgsql/data 41 42 # Where to send early-startup messages from the server (before the logging 43 # options of postgresql.conf take effect) 44 # This is normally controlled by the global default set by systemd 45 # StandardOutput=syslog 46 47 # Disable OOM kill on the postmaster 48 OOMScoreAdjust=-1000 49 50 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} 51 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300 52 ExecStop=/usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast 53 ExecReload=/usr/bin/pg_ctl reload -D ${PGDATA} -s 54 55 # Give a reasonable amount of time for the server to start up/shut down 56 TimeoutSec=300 57 58 [Install] 59 WantedBy=multi-user.target
这个文件何时被生成的有空可以去测试下,源码安装的时候
/usr/lib/systemd/system/目录下并未有postgresql.service相关文件。
这个我觉得流程是比较符合我的猜想。
上图文件内容足够可以对postgres完成启动关闭等等一系列任务,
但还有一个问题就是enable的时候设置了postgres开机启动,disable禁止开机启动。
enable和disable是改变了什么?
那就直接看吧!
[root@db222 system]# systemctl disable postgresql rm '/etc/systemd/system/multi-user.target.wants/postgresql.service'[root@db222 system]# systemctl enable postgresql ln -s '/usr/lib/systemd/system/postgresql.service' '/etc/systemd/system/multi-user.target.wants/postgresql.service'
更详细的分析,我也没查阅到。我只能说对比了下centos6.5是没有这个文件夹的吧。
暂且理解为内核硬编码进去默认的查找文件吧。
0 0
- Centos7下systemctl status postgresql 命令相关研究
- Centos7服务systemctl命令
- Centos7下的systemctl命令与service和chkconfig
- Centos7下的systemctl命令与service和chkconfig
- Centos7下的systemctl命令与service和chkconfig
- 在CentOS7中systemctl命令
- CentOS7中systemctl命令详解
- Centos7 systemctl命令简单介绍
- CentOS7下初始化PostgreSQL
- CentOS7下PostgreSQL安装
- CentOS7下初始化PostgreSQL
- systemctl管理服务的相关命令
- postgresql 相关命令1
- CentOS7安装mariadb后再安装msyql时systemctl status mysqld无法启动
- systemctl命令
- Systemctl命令
- systemctl命令
- systemctl命令
- UVA 11991 Easy Problem from Rujia Liu?
- 关于CI框架引入CSS与JS文件
- hadoop-common源码分析之-Configuration
- leetcode 222 Count Complete Tree Nodes (计算完全二叉树节点数)
- Vim 简明教程
- Centos7下systemctl status postgresql 命令相关研究
- C++数组的简单示例
- 1、flume安装
- linux 静态库函数查看
- poj1623 象限四分树
- offsetLeft 与 style.left、offsetWidth 与 style.width、offsetHeight 与 style.height 等区别
- Apache配置虚拟主机
- 2015-第14周项目1-小玩文件
- 2、flume的log4j的数据导入