COMP9311 Database Systems Lab1

1. 主要内容

配置PostgreSQL环境

2. 配置步骤

2.1 远程连接

Taggi
Mac在terminal中输入ssh [email protected]
接下来会提示输入密码,之后顺利远程连接,Terminal的提示符会变成weber %

2.2 创建server directory

输入ssh grieg,登录grieg电脑
输入priv srvr,创建/srvr的路径

2.3创建PostgreSQL Server

首先确认上一步创建的/srvr的路径,输入ls -l /srvr/z1234567
输入cp /srvr/z1234567
然后copy PostgreSQL source code,输入cp /home/cs9311/web/17s2//postgresql/postgresql-9.3.3.tar.bz2 /srvr/z1234567
再解压copy的source code,输入tar xfj /srvr/z1234567/postgresql-9.3.3.tar.bz2
进入安装路径,输入cd /srvr/z1234567/postgresql-9.3.3
输入./configure --prefix=/srvr/z1234567/pgsql
输入make,准备进行安装,最后显示All of PostgreSQL successfully made. Ready to install.
输入make install,安装,最后显示PostgreSQL installation complete.
输入cp /home/cs9311/web/17s2/postgresql/env /srvr/z1234567,拷贝env文件
输入source /srvr/z5140515/env,运行env文件
修改postgresql.conf,输入vim $PGDATA/postgresql.conf,在内容中修改以下信息,进入程序后用下箭头寻找下面的内容,修改的时候先按“I”,修改完按esc,之后输入:wq

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = ''修改这里       # what IP address(es) to listen on;
                            # comma-separated list of addresses;
                            # defaults to 'localhost', '*' = all
                            # (change requires restart)
#port = 5432                #(change requires restart)
max_connections = 15修改这里            # (change requires restart)
# Note:  Increasing max_connections costs ~400 bytes of shared memory per 
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3 # (change requires restart)
unix_socket_directories = '/srvr/z1234567/pgsql/data'修改这里
#unix_socket_group = ''         # (change requires restart)
#unix_socket_permissions = 0777     # begin with 0 to use octal notation
                    # (change requires restart)

2.4 启动server

输入pg_ctl start -l $PGDATA/log
检查是否成功,输入psql -l

2.5 停止server

输入pg_ctl stop

3.日常使用

输入ssh [email protected]
输入source /srvr/z1234567/env
输入pgs setup
输入pgs start
输入createdb "myNewDB"(可替换)
输入psql "myNewDB"(可替换)
输入pgs stop停止

你可能感兴趣的:(COMP9311 Database Systems Lab1)