Hprc banner tamu.png

Difference between revisions of "SW:PostgreSQL"

From TAMU HPRC
Jump to: navigation, search
(PostgreSQL on Ada)
(PostgreSQL on Ada)
Line 23: Line 23:
 
         /scratch/user/yangliu/Test/postresql/test.log start
 
         /scratch/user/yangliu/Test/postresql/test.log start
 
         #comment: the -o provides extra options. In this example, the extra option is
 
         #comment: the -o provides extra options. In this example, the extra option is
         the port by -p. the -D option specified where is the database file. The -l
+
         #the port by -p. the -D option specified where is the database file. The -l
         option specify the log file for the database instance.
+
         #option specify the log file for the database instance.
 
  (4) createdb yang -p 9999
 
  (4) createdb yang -p 9999
  (5) psql -d yang -p 999
+
  (5) psql -d yang -p 9999    #connect to database by user yang on port 9999
 
  (6) execute your sql statments in psql
 
  (6) execute your sql statments in psql
  (7) pg_ctl -D /scratch/user/yangliu/Test/postresql/test.db stop
+
  (7) pg_ctl -D /scratch/user/yangliu/Test/postresql/test.db stop # stop the database
  
You may set password for your database if it is needed. This is the commands
+
You may set password for your database if it is needed. These are the commands
for the first time set up of postgres. After this, you only need to startup the
+
for the first time set up of PostgresSQL. After this, you only need to start the
server, connect to it, and stop it. You only need to initdb, createdb for one
+
server, connect to it, and stop it, i.e., step (3), (5), (6) and (7). You only need to initdb (step 1), createdb (step 4) for one
time. Let us know If you have further questions.
+
time.
 +
 
 +
Note: the database directory and name, database username, and port should be changed by users.

Revision as of 09:04, 29 March 2018

PostgreSQL

Description

PostgreSQL is a powerful, open source object-relational database system.

Access

PostgreSQL is open to all HPRC users.

PostgreSQL Module

TAMU HPRC currently supports the user of PostgreSQL though the PostgreSQL modules. There are several PostgreSQL modules available on Ada and Terra.


You can learn more about the module system on our SW:Modules page.


PostgreSQL on Ada

1) module load PostgreSQL/9.6.1-GCCcore-6.3.0-Python-2.7.12-bare
(2) initdb -D /scratch/user/yangliu/Test/postresql/test.db
(3) pg_ctl -o "-p 9999" -D /scratch/user/yangliu/Test/postresql/test.db -l
       /scratch/user/yangliu/Test/postresql/test.log start
       #comment: the -o provides extra options. In this example, the extra option is
       #the port by -p. the -D option specified where is the database file. The -l
       #option specify the log file for the database instance.
(4) createdb yang -p 9999
(5) psql -d yang -p 9999    #connect to database by user yang on port 9999
(6) execute your sql statments in psql
(7) pg_ctl -D /scratch/user/yangliu/Test/postresql/test.db stop  # stop the database

You may set password for your database if it is needed. These are the commands for the first time set up of PostgresSQL. After this, you only need to start the server, connect to it, and stop it, i.e., step (3), (5), (6) and (7). You only need to initdb (step 1), createdb (step 4) for one time.

Note: the database directory and name, database username, and port should be changed by users.