Changes between Version 4 and Version 5 of Sensors/Grimm/settingUpPostgresDB
- Timestamp:
- Oct 8, 2014, 11:59:01 AM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Sensors/Grimm/settingUpPostgresDB
v4 v5 4 4 You will need sudo on that machine. 5 5 6 - install postgres: 7 sudo yum install postgresql 6 - install postgres: [[BR]] 7 sudo yum install postgresql[[BR]] 8 8 sudo yum install postgresql-server 9 9 10 10 postgres tends to install its files under the username postgres. You should therefore create and use this user for the steps below. Specifically you need access to /var/run/postgresql/ 11 11 12 - make a directory for posgres data: 12 - make a directory for posgres data: [[BR]] 13 13 mkdir -p /usr/local/pgsql/data 14 14 15 - Create a database cluster (file structure) 15 - Create a database cluster (file structure) [[BR]] 16 16 initdb -D /usr/local/pgsql/data 17 17 18 - Initialise the server (I think I only need to do the second of these things) 19 postmaster -D /usr/local/pgsql/data >logfile 2>&1 & 18 - Initialise the server (I think I only need to do the second of these things) [[BR]] 19 postmaster -D /usr/local/pgsql/data >logfile 2>&1 &[[BR]] 20 20 postgres -D /usr/local/pgsql/data & 21 21 22 - create database: 22 - create database: [[BR]] 23 23 createdb <db_name> 24 24 25 - To restart the server (after shutting down for example) 26 su - postgres 25 - To restart the server (after shutting down for example)[[BR]] 26 su - postgres[[BR]] 27 27 pg_ctl start -D /usr/local/pgsql/data 28 28 … … 34 34 There are two main config files, both in the above dir. 35 35 36 pg_hba.conf (the client authentication configuration file) 36 pg_hba.conf (the client authentication configuration file)[[BR]] 37 37 postgresql.conf (all sorts of things) 38 38 39 39 You need to explicity allow for external hosts to connect to the database: 40 40 41 pg_hba.conf: 42 # IPv4 local connections: 41 pg_hba.conf:[[BR]] 42 # IPv4 local connections:[[BR]] 43 43 host all all 192.171.161.1/24 trust 44 44 45 postgresql.conf 45 postgresql.conf[[BR]] 46 46 listen_addresses = '*' 47 47 48 pg_ctl is a utility for monitoring and controlling a posgreSQL server 49 Check server status: 50 pg_ctl status -D /usr/local/pgsql/data 48 pg_ctl is a utility for monitoring and controlling a posgreSQL server[[BR]] 49 Check server status:[[BR]] 50 pg_ctl status -D /usr/local/pgsql/data[[BR]] 51 51 pg_ctl: server is running (PID: 29763)