Steps to add new database in Scidb18
01. Add a new database user in Postgresql
scidb@sangron:~$ sudo -u postgres psql postgres=# CREATE USER db_twelve PASSWORD 'db_twelve'; postgres=# CREATE DATABASE db_twelve; postgres=# GRANT ALL PRIVILEGES ON DATABASE db_twelve TO db_twelve; postgres=# ALTER DATABASE db_twelve OWNER TO db_twelve; postgres=# ALTER USER db_twelve WITH superuser;
or
scidb@sangron:~$ sudo -u postgres createuser db_twelve scidb@sangron:~$ sudo -u postgres createdb db_twelve scidb@sangron:~$ sudo -u postgres psql psql=# alter user db_twelve with encrypted password 'db_twelve'; psql=# grant all privileges on database db_twelve to db_twelve; psql=# alter user db_twelve with superuser;
02. Write new user’s postgresql login information in /home/scidb/.pgpass
scidb@sangron:~$ vim ~/.pgpass sangron:5432:db_twelve:db_twelve:db_twelve
03. Write configure file for the new database
[<db_name>] server-0=sangron,1 server-1=sangron-1,1 ... db_user=<db_user_name> redundancy=1 install_root=/opt/scidb/18.1 pluginsdir=/opt/scidb/18.1/lib/scidb/plugins logconf=/opt/scidb/18.1/share/scidb/log4cxx.properties base-path=<db_path> base-port=1239 interface=eth0 security=trust
WARNING:
Redundancy must be >= 0 and < number of servers
04. Init the new database
scidb@sangron:~$ scidb.py initall <cluster_name> <config.ini>
Steps to re-install postgresql
01. Remove postgresql pre-installed on the server
scidb@sangron:~$ sudo apt-get purge postgr* scidb@sangron:~$ sudo apt-get autoremove
02. Install postgresql
scidb@sangron:~$ apt-get install postgresql
or
scidb@sangron:~$ apt-get install postgresql-9.3
03. Modify configurations
Allow access from anywhere through any user account
scidb@sangron:~$ sudo vim /etc/postgresql/<version>/main/postgresql.conf listen_addresses = '*' # what IP address(es) to listen on;
scidb@sangron:~$ sudo vim /etc/postgresql/<version>/main/pg_hba.conf local all postgres peer # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 0.0.0.0/0 md5 # IPv6 local connections: host all all ::1/128 md5 # Allow replication connections from localhost, by a user with the # replication privilege. #local replication postgres peer #host replication postgres 127.0.0.1/32 md5 #host replication postgres ::1/128 md5
04. Restart Postgresql
scidb@sangron:~$ /etc/init.d/postgresql restart
or
scidb@sangron:~$ service postgresql restart
postgresql을 처음 시작할 때 필요한 간단 명령어
Tonic 's lesson learned