加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

PostgreSQL数据库psql的使用之三

发布时间:2020-12-13 16:57:42 所属栏目:百科 来源:网络整理
导读:[postgres@rhel73 data]$ [postgres@rhel73 data]$ psql -l -p 5432 List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres
[postgres@rhel73 data]$ 
[postgres@rhel73 data]$ psql -l -p 5432
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 test      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
(4 rows)


[postgres@rhel73 data]$ psql -l -p 5433
psql: could not connect to server: No such file or directory ------>>>从此处可以看出,PG是用端口号来区分不同的cluster.
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5433"?
[postgres@rhel73 data]$ exit
[root@rhel73 ~]# netstat -lpntu| grep --color -i -E 'listen|listening' | grep 5432
tcp        0      0 127.0.0.1:5432          0.0.0.0:*         LISTEN      2632/postgres---->>2632是ospid,见下面的命令
tcp6       0      0 ::1:5432                :::*              LISTEN      2632/postgres       
[root@rhel73 ~]# ps -ef | grep 2632
postgres  2632     1  0 03:51 pts/0    00:00:00 /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
postgres  2634  2632  0 03:51 ?        00:00:00 postgres: checkpointer process   
postgres  2635  2632  0 03:51 ?        00:00:00 postgres: writer process   
postgres  2636  2632  0 03:51 ?        00:00:00 postgres: wal writer process   
postgres  2637  2632  0 03:51 ?        00:00:00 postgres: autovacuum launcher process   
postgres  2638  2632  0 03:51 ?        00:00:00 postgres: stats collector process   
root      8190  2501  0 13:41 pts/0    00:00:00 grep --color=auto 2632
[root@rhel73 ~]# 
额外说一句:SAP Sybase ASE也是用端口号来区分不同的数据库服务.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读