PostgreSQL数据库安装部署(3)

listen_addresses = '*'  #为了方便,监听所有# what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost'; use '*' for all
                                        # (change requires restart)
#port = 5432                            # (change requires restart)
max_connections = 100                  # (change requires restart)
#superuser_reserved_connections = 3    # (change requires restart)
#unix_socket_directories = '/tmp'      # comma-separated list of directories
                                        # (change requires restart)
#unix_socket_group = ''                # (change requires restart)
#unix_socket_permissions = 0777        # begin with 0 to use octal notation
#########################################

  19、创建log目录用于存放开机日志,及启动数据库

[postgres@web1 data]$ mkdir /usr/local/pgsql/log
[postgres@web1 data]$ pg_ctl start -l /usr/local/pgsql-10.5/log/pg_server.log
waiting for server to start.... done
server started
[postgres@web1 data]$

  20、检查是否启动,可以看日志

[postgres@web1 data]$ lsof -i:5432
COMMAND    PID    USER  FD  TYPE DEVICE SIZE/OFF NODE NAME
postgres 25479 postgres    3u  IPv4  50990      0t0  TCP *:postgres (LISTEN)
postgres 25479 postgres    4u  IPv6  50991      0t0  TCP *:postgres (LISTEN)
[postgres@web1 data]$ netstat -lnutp|grep postgres
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:5432            0.0.0.0:*              LISTEN      25479/postgres     
tcp6      0      0 :::5432                :::*                    LISTEN      25479/postgres     
[postgres@web1 data]$ ps -ef|grep postgres
root    24060  1297  0 18:17 pts/0    00:00:00 su postgres
postgres 24061 24060  0 18:17 pts/0    00:00:00 bash
postgres 25479    1  0 18:45 pts/0    00:00:00 /usr/local/pgsql-10.5/bin/postgres
postgres 25481 25479  0 18:45 ?        00:00:00 postgres: checkpointer process 
postgres 25482 25479  0 18:45 ?        00:00:00 postgres: writer process 
postgres 25483 25479  0 18:45 ?        00:00:00 postgres: wal writer process 
postgres 25484 25479  0 18:45 ?        00:00:00 postgres: autovacuum launcher process 
postgres 25485 25479  0 18:45 ?        00:00:00 postgres: stats collector process 
postgres 25486 25479  0 18:45 ?        00:00:00 postgres: bgworker: logical replication launcher 
postgres 25543 24061  0 18:46 pts/0    00:00:00 ps -ef
postgres 25544 24061  0 18:46 pts/0    00:00:00 grep --color=auto postgres
[postgres@web1 data]$

  21、进入库的一些小操作

[postgres@web1 data]$ psql    #进入库
psql (10.5)
Type "help" for help.

postgres=# \password    #设置密码
Enter new password:
Enter it again:
postgres=# CREATE DATABASE name;      #创建库
CREATE DATABASE
postgres=# \du    #查看用户
                                  List of roles
 Role name |                        Attributes                        | Member of
-----------+------------------------------------------------------------+-----------
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/15dd67eb13e2cd9f8fd027e133d9cf53.html