如何启动postgresql
2023-04-18 14:24:55 时间
启动数据库服务器(posgres用户):
[postgres@localhost bin]$ postgres -D /opt/postgresql/data/ > /opt/postgresql/log/pg_server.log 2>&1 & [1] 4508
当然如果设置了环境变量
PGDATA=/opt/postgresql/data export PGDATA
后,可使用pg_ctl工具进行启动:
[postgres@localhost log]$ pg_ctl start -l /opt/postgresql/log/pg_server.log pg_ctl: another server might be running; trying to start server anyway pg_ctl: could not start server Examine the log output. [postgres@localhost log]$
因为之前已经启动,所以打印“another server might be running”。此时,查看日志,有如下信息:
[postgres@localhost log]$ cat pg_server.log FATAL: lock file "postmaster.pid" already exists HINT: Is another postmaster (PID 4491) running in data directory "/opt/postgresql/data"? [postgres@localhost log]$
当然,最简的启动方式是:
[postgres@localhost ~]$ pg_ctl start server starting [postgres@localhost ~]$ LOG: database system was shut down at 2011-07-09 13:58:00 CST LOG: autovacuum launcher started LOG: database system is ready to accept connections
如果要在操作系统启动时就启动PG,可以在/etc/rc.d/rc.local 文件中加以下语句:
/opt/postgresql/bin/pg_ctl start -l /opt/postgresql/log/pg_server.log -D /opt/postgresql/data
相关文章
- Python使用tkinter组件Label显示简单数学公式
- 内网渗透之DCOM横向移动
- 以目标为导向的语义交流的共同语言——一个课程学习框架
- python爬虫前奏【成信笔记】
- HTML 5 File API:文件拖放上传功能
- 教你快速创建 Python 虚拟环境
- pyenv 实现Python多版本自由切换
- 用 Python 对 Excel文件进行批量操作
- Python - 接入钉钉机器人
- Python - 抓取 iphone13 pro 线下店供货信息并发送到钉钉机器人,最后设置为定时任务
- crontab - 解决 mac 下通过 crontab 设置了 Python 脚本的定时任务却无法运行
- [源码解析] PyTorch分布式(5) ------ DistributedDataParallel 总述&如何使用
- Python科普系列——类与方法(上篇)
- SAP对STO的交货单执行PGI,报错 -Fld selectn for mvmt type 643 acct 400020 differs
- Spring Boot 实现通用 Auth 认证的 4 种方式
- 盘点4种使用Python批量合并同一文件夹内所有子文件夹下的Excel文件内所有Sheet数据
- OushuDB 学习经验分享(三):技术特点
- Java和Python思维方式的不同之处
- Python中日志记录新技能
- 奥比中光Gemini OpenCV—Python使用