Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ PostgreSQL 9.3.5 database installation under Ubuntu Server 14.04     - 20 Top Linux commands (Linux)

- MySQL Installation Troubleshooting (Database)

- Android Custom View step (Programming)

- Docker data container protection the pros and cons (Server)

- Pydev installed and configured on the Eclipse (Linux)

- Oracle Data File Management (Database)

- How to disable IPv6 in the CentOS 7 (Linux)

- Each catalog Detailed Linux (Linux)

- Android to determine whether the device to open WIFI, GPRS data connection (Programming)

- Java synchronization mechanism used in locking Thought (Programming)

- Linux FTP setting file description (Server)

- MySQL InnoDB table --BTree basic data structures (Database)

- Installation Atom text editor on Mint Ubuntu / Linux (Linux)

- File SUID, SGID, Sticky property (Linux)

- Which file system is most suitable for your Linux system (Linux)

- CentOS 7.0 Enable iptables firewall (Linux)

- Using Vagrant to build multi-platform environment (Server)

- Lua4.0 interpreter entrance (Programming)

- Oracle bdump file soaring (Database)

- Oracle RMAN repair logical bad blocks (Database)

 
         
  PostgreSQL 9.3.5 database installation under Ubuntu Server 14.04
     
  Add Date : 2018-11-21      
         
         
         
  PostgreSQL is a free open source object - relational database server (database management system), released under the BSD license. PostgreSQL is free to use, modify and distribute, whether private, commercial, academic or research use. PostgreSQL provides relative to other open source database system (such as: MySQL and Firebird) and proprietary database systems: Another option (such as Oracle, Sybase, IBM's DB2 and Microsoft SQL Server) outside.

PostgreSQL unusual name caused some readers to stop and try to spell it, especially those of the SQL spelling of "sequel" of the people. PostgreSQL developers to spell it as "post-gress-Q-L". It is also often abbreviated to read "postgres".

PostgreSQL is the "University of California, Berkeley," Department of Computer developed POSTGRES (now renamed PostgreSQL) version 4.2-based object-relational database management system (ORDBMS). PostgreSQL supports most of the SQL standard and offers many other modern features, including: complex queries, foreign keys, triggers, views, transactional integrity, MVCC. Similarly, PostgreSQL extensions can be used many ways; for example: by adding new data types, functions, operators, aggregate functions, index.

01 to apt-get install PostgreSQL 9.3.5

root: # apt-get install postgresql
Reading package lists ... Done
Building dependency tree package
Reading state information ... Done
The following extra packages will be installed:
  libpq5 postgresql-9.3 postgresql-client-9.3 postgresql-client-common
  postgresql-common ssl-cert
Recommendation installed packages:
  oidentd ident-server locales-all postgresql-doc-9.3 openssl-blacklist
The following NEW packages will be installed:
  libpq5 postgresql postgresql-9.3 postgresql-client-9.3
  postgresql-client-common postgresql-common ssl-cert
0 packages upgraded, 7 newly installed software package, to uninstall packages 0, 0 not upgraded packages.
3,682 kB need to download packages.
It will consume 15.5 MB additional space after decompression.
Do you want to continue? [Y / n] y
Get: 1 [url] http://cn.archive.ubuntu.com/ubuntu/ [/ url] trusty-updates / main libpq5 amd64 9.3.5-0ubuntu0.14.04.1 [80.6 kB]
Get: 2 [url] http://cn.archive.ubuntu.com/ubuntu/ [/ url] trusty / main postgresql-client-common all 154 [25.4 kB]
Get: 3 [url] http://cn.archive.ubuntu.com/ubuntu/ [/ url] trusty-updates / main postgresql-client-9.3 amd64 9.3.5-0ubuntu0.14.04.1 [782 kB]
Get: 4 [url] http://cn.archive.ubuntu.com/ubuntu/ [/ url] trusty / main ssl-cert all 1.0.33 [16.6 kB]
Get: 5 [url] http://cn.archive.ubuntu.com/ubuntu/ [/ url] trusty / main postgresql-common all 154 [103 kB]
Get: 6 [url] http://cn.archive.ubuntu.com/ubuntu/ [/ url] trusty-updates / main postgresql-9.3 amd64 9.3.5-0ubuntu0.14.04.1 [2,670 kB]
Get: 7 [url] http://cn.archive.ubuntu.com/ubuntu/ [/ url] trusty / main postgresql all 9.3 + 154 [5,088 B]
Download 3,682 kB, took 9 seconds (402 kB / s)
Packages are pre-set ...
Selecting previously unselected package libpq5.
(Reading database ... system's current total installed 85656 files and directories.)
Preparing to unpack ... / libpq5_9.3.5-0ubuntu0.14.04.1_amd64.deb ...
Unpacking libpq5 (9.3.5-0ubuntu0.14.04.1) ...
Selecting previously unselected package postgresql-client-common.
Preparing to unpack ... / postgresql-client-common_154_all.deb ...
Unpacking postgresql-client-common (154) ...
Selecting previously unselected package postgresql-client-9.3.
Preparing to unpack ... / postgresql-client-9.3_9.3.5-0ubuntu0.14.04.1_amd64.deb ...
Unpacking postgresql-client-9.3 (9.3.5-0ubuntu0.14.04.1) ...
Selecting previously unselected package ssl-cert.
Preparing to unpack ... / ssl-cert_1.0.33_all.deb ...
Unpacking ssl-cert (1.0.33) ...
Selecting previously unselected package postgresql-common.
Preparing to unpack ... / postgresql-common_154_all.deb ...
Adding postgresql-common cause / usr / bin / pg_config local modifications to /usr/bin/pg_config.libpq-dev
Unpacking postgresql-common (154) ...
Selecting previously unselected package postgresql-9.3.
Preparing to unpack ... / postgresql-9.3_9.3.5-0ubuntu0.14.04.1_amd64.deb ...
Unpacking postgresql-9.3 (9.3.5-0ubuntu0.14.04.1) ...
Selecting previously unselected package postgresql.
Preparing to unpack ... / postgresql_9.3 + 154_all.deb ...
Unpacking postgresql (9.3 + 154) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
We are set libpq5 (9.3.5-0ubuntu0.14.04.1) ...
Being set postgresql-client-common (154) ...
Being set postgresql-client-9.3 (9.3.5-0ubuntu0.14.04.1) ...
update-alternatives: using /usr/share/postgresql/9.3/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in automatic mode
Being set ssl-cert (1.0.33) ...
We are set postgresql-common (154) ...
Adding user postgres to group ssl-cert

Creating config file /etc/logrotate.d/postgresql-common with new version
Building PostgreSQL dictionaries from installed myspell / hunspell packages ...
Removing obsolete dictionary files:
 * No PostgreSQL clusters exist; see "man pg_createcluster"
Processing triggers for ureadahead (0.100.0-16) ...
We are set postgresql-9.3 (9.3.5-0ubuntu0.14.04.1) ...
Creating new cluster 9.3 / main ...
  config /etc/postgresql/9.3/main
  data /var/lib/postgresql/9.3/main
  locale zh_CN.UTF-8
  port 5432
update-alternatives: using /usr/share/postgresql/9.3/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in automatic mode
 * Starting PostgreSQL 9.3 database server [OK]
We are set postgresql (9.3 + 154) ...
Processing triggers for libc-bin (2.19-0ubuntu6.5) ...
root: #

02, set up Ubuntu Server 14.04 postgres system user login password

root: # passwd postgres
Enter new UNIX password:
Re-enter the new UNIX password:
passwd: password updated successfully
root: #

03, switch to the postgres system user

root: # su - postgres or sudo -i -u postgres
postgres: ~ $

04, login postgres database

postgres: ~ $ psql postgres
psql (9.3.5)
Type "help" for help.

postgres = # #postgres command prompt

05, will set postgres postgres database user password or other

postgres = # ALTER USER postgres with PASSWORD 'postgres';
ALTER ROLE
postgres = # \ q
could not save history to file "/var/lib/postgresql/.psql_history": No such file or directory # log back in it, because the first file does not exist
postgres: ~ $

06, landing again postgres database, then set postgres postgres database user password or other

postgres: ~ $ psql postgres
psql (9.3.5)
Type "help" for help.

postgres = # ALTER USER postgres with PASSWORD 'postgres';
ALTER ROLE
postgres = # \ q
postgres: ~ $

07, modify the database configuration file postgresql.conf PostgresSQL

vi /etc/postgresql/9.3/main/postgresql.conf

Profile before modification

# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
# Name = value
#
# (The "=" is optional.) Whitespace may be used. Comments are introduced with
# "#" Anywhere on a line. The complete list of parameter names and allowed
# Values can be found in the PostgreSQL documentation.
#
# The commented-out settings shown in this file represent the default values.
# Re-commenting a setting is NOT sufficient to revert it to the default value;
# I need to reload the server.
#
# This file is read on server startup and when the server receives a SIGHUP
# Signal. If you edit the file on a running system, you have to SIGHUP the
# Server for the changes to take effect, or use "pg_ctl reload". Some
# Parameters, which are marked below, require a server shutdown and restart to
# Take effect.
#
# Any parameter can also be given as a command-line option to the server, e.g.,
# "Postgres -c log_connections = on". Some parameters can be changed at run time
# With the "SET" SQL command.
#
# Memory units: kB = kilobytes Time units: ms = milliseconds
# MB = megabytes s = seconds
# GB = gigabytes min = minutes
# H = hours
# D = days


# ------------------------------------------------- -----------------------------
# FILE LOCATIONS
# ------------------------------------------------- -----------------------------

# The default values of these variables are driven from the -D command-line
# Option or PGDATA environment variable, represented here as ConfigDir.

data_directory = '/var/lib/postgresql/9.3/main' # use data in another directory
                    # (Change requires restart)
hba_file = '/etc/postgresql/9.3/main/pg_hba.conf' # host-based authentication file
                    # (Change requires restart)
ident_file = '/etc/postgresql/9.3/main/pg_ident.conf' # ident configuration file
                    # (Change requires restart)

# If external_pid_file is not explicitly set, no extra PID file is written.
external_pid_file = '/var/run/postgresql/9.3-main.pid' # write an extra PID file
                    # (Change requires restart)


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

# - Connection Settings -

#listen_addresses = 'localhost' # 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)
# 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 = '/ var / run / postgresql' # 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
                    # (Change requires restart)
#bonjour = off # advertise server via Bonjour
                    # (Change requires restart)
#bonjour_name = '' # defaults to the computer name
                    # (Change requires restart)

# - Security and Authentication -

#authentication_timeout = 1min # 1s-600s
ssl = true # (change requires restart)
#ssl_ciphers = 'DEFAULT:! LOW:! EXP:! MD5: @STRENGTH' # allowed SSL ciphers
                    # (Change requires restart)
#ssl_renegotiation_limit = 512MB # amount of data between renegotiations
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' # (change requires restart)
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' # (change requires restart)
#ssl_ca_file = '' # (change requires restart)
#ssl_crl_file = '' # (change requires restart)
#password_encryption = on
#db_user_namespace = off

# Kerberos and GSSAPI
#krb_server_keyfile = ''
#krb_srvname = 'postgres' # (Kerberos only)
#krb_caseins_users = off

# - TCP Keepalives -
# See "man 7 tcp" for details

#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
                    # 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
                    # 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
                    # 0 selects the system default


# ------------------------------------------------- -----------------------------
# RESOURCE USAGE (except WAL)
# ------------------------------------------------- -----------------------------

# - Memory -

shared_buffers = 128MB # min 128kB
                    # (Change requires restart)
#temp_buffers = 8MB # min 800kB
#max_prepared_transactions = 0 # zero disables the feature
                    # (Change requires restart)
# Note: Increasing max_prepared_transactions costs ~ 600 bytes of shared memory
# Per transaction slot, plus lock space (see max_locks_per_transaction).
# It is not advisable to set max_prepared_transactions nonzero unless you
# Actively intend to use prepared transactions.
#work_mem = 1MB # min 64kB
#maintenance_work_mem = 16MB # min 1MB
#max_stack_depth = 2MB # min 100kB

# - Disk -

#temp_file_limit = -1 # limits per-session temp file space
                    # In kB, or -1 for no limit

# - Kernel Resource Usage -

#max_files_per_process = 1000 # min 25
                    # (Change requires restart)
#shared_preload_libraries = '' # (change requires restart)

# - Cost-Based Vacuum Delay -

#vacuum_cost_delay = 0 # 0-100 milliseconds
#vacuum_cost_page_hit = 1 # 0-10000 credits
#vacuum_cost_page_miss = 10 # 0-10000 credits
#vacuum_cost_page_dirty = 20 # 0-10000 credits
#vacuum_cost_limit = 200 # 1-10000 credits

# - Background Writer -

#bgwriter_delay = 200ms # 10-10000ms between rounds
#bgwriter_lru_maxpages = 100 # 0-1000 max buffers written / round
#bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned / round

# - Asynchronous Behavior -

#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching


# ------------------------------------------------- -----------------------------
# WRITE AHEAD LOG
# ------------------------------------------------- -----------------------------

# - Settings -

#wal_level = minimal # minimal, archive, or hot_standby
                    # (Change requires restart)
#fsync = on # turns forced synchronization on or off
#synchronous_commit = on # synchronization level;
                    # Off, local, remote_write, or on
#wal_sync_method = fsync # the default is the first option
                    # Supported by the operating system:
                    # Open_datasync
                    # Fdatasync (default on Linux)
                    # Fsync
                    # Fsync_writethrough
                    # Open_sync
#full_page_writes = on # recover from partial page writes
#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers
                    # (Change requires restart)
#wal_writer_delay = 200ms # 1-10000 milliseconds

#commit_delay = 0 # range 0-100000, in microseconds
#commit_siblings = 5 # range 1-1000

# - Checkpoints -

#checkpoint_segments = 3 # in logfile segments, min 1, 16MB each
#checkpoint_timeout = 5min # range 30s-1h
#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
#checkpoint_warning = 30s # 0 disables

# - Archiving -

#archive_mode = off # allows archiving to be done
                # (Change requires restart)
#archive_command = '' # command to use to archive a logfile segment
                # Placeholders:% p = path of file to archive
                #% F = file name only
                # E.g. 'test! -f / Mnt / server / archivedir /% f && cp% p / mnt / server / archivedir /% f'
#archive_timeout = 0 # force a logfile segment switch after this
                # Number of seconds; 0 disables


# ------------------------------------------------- -----------------------------
# REPLICATION
# ------------------------------------------------- -----------------------------

# - Sending Server (s) -

# Set these on the master and on any standby that will send replication data.

#max_wal_senders = 0 # max number of walsender processes
                # (Change requires restart)
#wal_keep_segments = 0 # in logfile segments, 16MB each; 0 disables
#wal_sender_timeout = 60s # in milliseconds; 0 disables

# - Master Server -

# These settings are ignored on a standby server.

#synchronous_standby_names = '' # standby servers that provide sync rep
                # Comma-separated list of application_name
                # From standby (s); '*' = all
#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed

# - Standby Servers -

# These settings are ignored on a master server.

#hot_standby = off # "on" allows queries during recovery
                    # (Change requires restart)
#max_standby_archive_delay = 30s # max delay before canceling queries
                    # When reading WAL from archive;
                    # -1 Allows indefinite delay
#max_standby_streaming_delay = 30s # max delay before canceling queries
                    # When reading streaming WAL;
                    # -1 Allows indefinite delay
#wal_receiver_status_interval = 10s # send replies at least this often
                    # 0 disables
#hot_standby_feedback = off # send info from standby to prevent
                    # Query conflicts
#wal_receiver_timeout = 60s # time that receiver waits for
                    # Communication from master
                    # In milliseconds; 0 disables


# ------------------------------------------------- -----------------------------
# QUERY TUNING
# ------------------------------------------------- -----------------------------

# - Planner Method Configuration -

#enable_bitmapscan = on
#enable_hashagg = on
#enable_hashjoin = on
#enable_indexscan = on
#enable_indexonlyscan = on
#enable_material = on
#enable_mergejoin = on
#enable_nestloop = on
#enable_seqscan = on
#enable_sort = on
#enable_tidscan = on

# - Planner Cost Constants -

#seq_page_cost = 1.0 # measured on an arbitrary scale
#random_page_cost = 4.0 # same scale as above
#cpu_tuple_cost = 0.01 # same scale as above
#cpu_index_tuple_cost = 0.005 # same scale as above
#cpu_operator_cost = 0.0025 # same scale as above
#effective_cache_size = 128MB

# - Genetic Query Optimizer -

#geqo = on
#geqo_threshold = 12
#geqo_effort = 5 # range 1-10
#geqo_pool_size = 0 # selects default based on effort
#geqo_generations = 0 # selects default based on effort
#geqo_selection_bias = 2.0 # range 1.5-2.0
#geqo_seed = 0.0 # range 0.0-1.0

# - Other Planner Options -

#default_statistics_target = 100 # range 1-10000
#constraint_exclusion = partition # on, off, or partition
#cursor_tuple_fraction = 0.1 # range 0.0-1.0
#from_collapse_limit = 8
#join_collapse_limit = 8 # 1 disables collapsing of explicit
                    # JOIN clauses


# ------------------------------------------------- -----------------------------
# ERROR REPORTING AND LOGGING
# ------------------------------------------------- -----------------------------

# - Where to Log -

#log_destination = 'stderr' # Valid values are combinations of
                    # Stderr, csvlog, syslog, and eventlog,
                    # Depending on platform. Csvlog
                    # Requires logging_collector to be on.

# This is used when logging to stderr:
#logging_collector = off # Enable capturing of stderr and csvlog
                    # Into log files. Required to be on for
                    # Csvlogs.
                    # (Change requires restart)

# These are only used if logging_collector is on:
#log_directory = 'pg_log' # directory where log files are written,
                    # Can be absolute or relative to PGDATA
#log_filename = 'postgresql-% Y-% m-% d_% H% M% S.log' # log file name pattern,
                    # Can include strftime () escapes
#log_file_mode = 0600 # creation mode for log files,
                    # Begin with 0 to use octal notation
#log_truncate_on_rotation = off # If on, an existing log file with the
                    # Same name as the new log file will be
                    # Truncated rather than appended to.
                    # But such truncation only occurs on
                    # Time-driven rotation, not on restarts
                    # Or size-driven rotation. Default is
                    # Off, meaning append to existing files
                    # In all cases.
#log_rotation_age = 1d # Automatic rotation of logfiles will
                    # Happen after that time. 0 disables.
#log_rotation_size = 10MB # Automatic rotation of logfiles will
                    # Happen after that much log output.
                    # 0 disables.

# These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'

# This is only relevant when logging to eventlog (win32):
#event_source = 'PostgreSQL'

# - When to Log -

#client_min_messages = notice # values in order of decreasing detail:
                    # Debug5
                    # Debug4
                    # Debug3
                    # Debug2
                    # Debug1
                    # Log
                    # Notice
                    # Warning
                    # Error

#log_min_messages = warning # values in order of decreasing detail:
                    # Debug5
                    # Debug4
                    # Debug3
                    # Debug2
                    # Debug1
                    # Info
                    # Notice
                    # Warning
                    # Error
                    # Log
                    # Fatal
                    # Panic

#log_min_error_statement = error # values in order of decreasing detail:
                    # Debug5
                    # Debug4
                    # Debug3
                    # Debug2
                    # Debug1
                    # Info
                    # Notice
                    # Warning
                    # Error
                    # Log
                    # Fatal
                    # Panic (effectively off)

#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
                    # And their durations,> 0 logs only
                    # Statements running at least this number
                    # Of milliseconds


# - What to Log -

#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
#debug_pretty_print = on
#log_checkpoints = off
#log_connections = off
#log_disconnections = off
#log_duration = off
#log_error_verbosity = default # terse, default, or verbose messages
#log_hostname = off
log_line_prefix = '% t' # special values:
                    #% A = application name
                    #% U = user name
                    #% D = database name
                    #% R = remote host and port
                    #% H = remote host
                    #% P = process ID
                    #% T = timestamp without milliseconds
                    #% M = timestamp with milliseconds
                    #% I = command tag
                    #% E = SQL state
                    #% C = session ID
                    #% L = session line number
                    #% S = session start timestamp
                    #% V = virtual transaction ID
                    #% X = transaction ID (0 if none)
                    #% Q = stop here in non-session
                    # Processes
                    # %% = '%'
                    # E.g. '<% u %%% d>'
#log_lock_waits = off # log lock waits> = deadlock_timeout
#log_statement = 'none' # none, ddl, mod, all
#log_temp_files = -1 # log temporary files equal or larger
                    # Than the specified size in kilobytes;
                    # -1 Disables, 0 logs all temp files
log_timezone = 'PRC'


# ------------------------------------------------- -----------------------------
# RUNTIME STATISTICS
# ------------------------------------------------- -----------------------------

# - Query / Index Statistics Collector -

#track_activities = on
#track_counts = on
#track_io_timing = off
#track_functions = none # none, pl, all
#track_activity_query_size = 1024 # (change requires restart)
#update_process_title = on
#stats_temp_directory = 'pg_stat_tmp'


# - Statistics Monitoring -

#log_parser_stats = off
#log_planner_stats = off
#log_executor_stats = off
#log_statement_stats = off

# ------------------------------------------------- -----------------------------
# AUTOVACUUM PARAMETERS
# ------------------------------------------------- -----------------------------

#autovacuum = on # Enable autovacuum subprocess? 'on'
                    # Requires track_counts to also be on.
#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and
                    # Their durations,> 0 logs only
                    # Actions running at least this number
                    # Of milliseconds.
#autovacuum_max_workers = 3 # max number of autovacuum subprocesses
                    # (Change requires restart)
#autovacuum_naptime = 1min # time between autovacuum runs
#autovacuum_vacuum_threshold = 50 # min number of row updates before
                    # Vacuum
#autovacuum_analyze_threshold = 50 # min number of row updates before
                    # Analyze
#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
                    # (Change requires restart)
#autovacuum_multixact_freeze_max_age = 400000000 # maximum Multixact age
                    # Before forced vacuum
                    # (Change requires restart)
#autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for
                    # Autovacuum, in milliseconds;
                    # -1 Means use vacuum_cost_delay
#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for
                    # Autovacuum, -1 means use
                    # Vacuum_cost_limit


# ------------------------------------------------- -----------------------------
# CLIENT CONNECTION DEFAULTS
# ------------------------------------------------- -----------------------------

# - Statement Behavior -

#search_path = ' "$ user", public' # schema names
#default_tablespace = '' # a tablespace name, '' uses the default
#temp_tablespaces = '' # a list of tablespace names, '' uses
                    # Only default tablespace
#check_function_bodies = on
#default_transaction_isolation = 'read committed'
#default_transaction_read_only = off
#default_transaction_deferrable = off
#session_replication_role = 'origin'
#statement_timeout = 0 # in milliseconds, 0 is disabled
#lock_timeout = 0 # in milliseconds, 0 is disabled
#vacuum_freeze_min_age = 50000000
#vacuum_freeze_table_age = 150000000
#vacuum_multixact_freeze_min_age = 5000000
#vacuum_multixact_freeze_table_age = 150000000
#bytea_output = 'hex' # hex, escape
#xmlbinary = 'base64'
#xmloption = 'content'

# - Locale and Formatting -

datestyle = 'iso, ymd'
#intervalstyle = 'postgres'
timezone = 'PRC'
#timezone_abbreviations = 'Default' # Select the set of available time zone
                    # Abbreviations. Currently, there are
                    # Default
                    # Australia
                    # India
                    # You can create your own file in
                    # Share / timezonesets /.
#extra_float_digits = 0 # min -15, max 3
#client_encoding = sql_ascii # actually, defaults to database
                    # Encoding

# These settings are initialized by initdb, but they can be changed.
lc_messages = 'zh_CN.UTF-8' # locale for system error message
                    # Strings
lc_monetary = 'zh_CN' # locale for monetary formatting
lc_numeric = 'zh_CN' # locale for number formatting
lc_time = 'zh_CN' # locale for time formatting

# Default configuration for text search
default_text_search_config = 'pg_catalog.simple'

# - Other Defaults -

#dynamic_library_path = '$ libdir'
#local_preload_libraries = ''


# ------------------------------------------------- -----------------------------
# LOCK MANAGEMENT
# ------------------------------------------------- -----------------------------

#deadlock_timeout = 1s
#max_locks_per_transaction = 64 # min 10
                    # (Change requires restart)
# Note: Each lock table slot uses ~ 270 bytes of shared memory, and there are
# Max_locks_per_transaction * (max_connections + max_prepared_transactions)
# Lock table slots.
#max_pred_locks_per_transaction = 64 # min 10
                    # (Change requires restart)


# ------------------------------------------------- -----------------------------
# VERSION / PLATFORM COMPATIBILITY
# ------------------------------------------------- -----------------------------

# - Previous PostgreSQL Versions -

#array_nulls = on
#backslash_quote = safe_encoding # on, off, or safe_encoding
#default_with_oids = off
#escape_string_warning = on
#lo_compat_privileges = off
#quote_all_identifiers = off
#sql_inheritance = on
#standard_conforming_strings = on
#synchronize_seqscans = on

# - Other Platforms and Clients -

#transform_null_equals = off


# ------------------------------------------------- -----------------------------
# ERROR HANDLING
# ------------------------------------------------- -----------------------------

#exit_on_error = off # terminate session on any error?
#restart_after_crash = on # reinitialize after backend crash?


# ------------------------------------------------- -----------------------------
# CONFIG FILE INCLUDES
# ------------------------------------------------- -----------------------------

# These options allow settings to be loaded from files other than the
# Default postgresql.conf.

#include_dir = 'conf.d' # include files ending in '.conf' from
                    # Directory 'conf.d'
#include_if_exists = 'exists.conf' # include file only if it exists
#include = 'special.conf' # include file


# ------------------------------------------------- -----------------------------
# CUSTOMIZED OPTIONS
# ------------------------------------------------- -----------------------------

# Add settings for extensions here

The modified configuration file

# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
# Name = value
#
# (The "=" is optional.) Whitespace may be used. Comments are introduced with
# "#" Anywhere on a line. The complete list of parameter names and allowed
# Values can be found in the PostgreSQL documentation.
#
# The commented-out settings shown in this file represent the default values.
# Re-commenting a setting is NOT sufficient to revert it to the default value;
# I need to reload the server.
#
# This file is read on server startup and when the server receives a SIGHUP
# Signal. If you edit the file on a running system, you have to SIGHUP the
# Server for the changes to take effect, or use "pg_ctl reload". Some
# Parameters, which are marked below, require a server shutdown and restart to
# Take effect.
#
# Any parameter can also be given as a command-line option to the server, e.g.,
# "Postgres -c log_connections = on". Some parameters can be changed at run time
# With the "SET" SQL command.
#
# Memory units: kB = kilobytes Time units: ms = milliseconds
# MB = megabytes s = seconds
# GB = gigabytes min = minutes
# H = hours
# D = days


# ------------------------------------------------- -----------------------------
# FILE LOCATIONS
# ------------------------------------------------- -----------------------------

# The default values of these variables are driven from the -D command-line
# Option or PGDATA environment variable, represented here as ConfigDir.

data_directory = '/var/lib/postgresql/9.3/main' # use data in another directory
                    # (Change requires restart)
hba_file = '/etc/postgresql/9.3/main/pg_hba.conf' # host-based authentication file
                    # (Change requires restart)
ident_file = '/etc/postgresql/9.3/main/pg_ident.conf' # ident configuration file
                    # (Change requires restart)

# If external_pid_file is not explicitly set, no extra PID file is written.
external_pid_file = '/var/run/postgresql/9.3-main.pid' # write an extra PID file
                    # (Change requires restart)


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

# - Connection Settings -

listen_addresses = '*' # what IP address (es) to listen on; # listen to any address
                    # 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)
# 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 = '/ var / run / postgresql' # 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
                    # (Change requires restart)
#bonjour = off # advertise server via Bonjour
                    # (Change requires restart)
#bonjour_name = '' # defaults to the computer name
                    # (Change requires restart)

# - Security and Authentication -

#authentication_timeout = 1min # 1s-600s
ssl = true # (change requires restart)
#ssl_ciphers = 'DEFAULT:! LOW:! EXP:! MD5: @STRENGTH' # allowed SSL ciphers
                    # (Change requires restart)
#ssl_renegotiation_limit = 512MB # amount of data between renegotiations
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' # (change requires restart)
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' # (change requires restart)
#ssl_ca_file = '' # (change requires restart)
#ssl_crl_file = '' # (change requires restart)
password_encryption = on # enable password encryption
#db_user_namespace = off

# Kerberos and GSSAPI
#krb_server_keyfile = ''
#krb_srvname = 'postgres' # (Kerberos only)
#krb_caseins_users = off

# - TCP Keepalives -
# See "man 7 tcp" for details

#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
                    # 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
                    # 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
                    # 0 selects the system default


# ------------------------------------------------- -----------------------------
# RESOURCE USAGE (except WAL)
# ------------------------------------------------- -----------------------------

# - Memory -

shared_buffers = 128MB # min 128kB
                    # (Change requires restart)
#temp_buffers = 8MB # min 800kB
#max_prepared_transactions = 0 # zero disables the feature
                    # (Change requires restart)
# Note: Increasing max_prepared_transactions costs ~ 600 bytes of shared memory
# Per transaction slot, plus lock space (see max_locks_per_transaction).
# It is not advisable to set max_prepared_transactions nonzero unless you
# Actively intend to use prepared transactions.
#work_mem = 1MB # min 64kB
#maintenance_work_mem = 16MB # min 1MB
#max_stack_depth = 2MB # min 100kB

# - Disk -

#temp_file_limit = -1 # limits per-session temp file space
                    # In kB, or -1 for no limit

# - Kernel Resource Usage -

#max_files_per_process = 1000 # min 25
                    # (Change requires restart)
#shared_preload_libraries = '' # (change requires restart)

# - Cost-Based Vacuum Delay -

#vacuum_cost_delay = 0 # 0-100 milliseconds
#vacuum_cost_page_hit = 1 # 0-10000 credits
#vacuum_cost_page_miss = 10 # 0-10000 credits
#vacuum_cost_page_dirty = 20 # 0-10000 credits
#vacuum_cost_limit = 200 # 1-10000 credits

# - Background Writer -

#bgwriter_delay = 200ms # 10-10000ms between rounds
#bgwriter_lru_maxpages = 100 # 0-1000 max buffers written / round
#bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned / round

# - Asynchronous Behavior -

#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching


# ------------------------------------------------- -----------------------------
# WRITE AHEAD LOG
# ------------------------------------------------- -----------------------------

# - Settings -

#wal_level = minimal # minimal, archive, or hot_standby
                    # (Change requires restart)
#fsync = on # turns forced synchronization on or off
#synchronous_commit = on # synchronization level;
                    # Off, local, remote_write, or on
#wal_sync_method = fsync # the default is the first option
                    # Supported by the operating system:
                    # Open_datasync
                    # Fdatasync (default on Linux)
                    # Fsync
                    # Fsync_writethrough
                    # Open_sync
#full_page_writes = on # recover from partial page writes
#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers
                    # (Change requires restart)
#wal_writer_delay = 200ms # 1-10000 milliseconds

#commit_delay = 0 # range 0-100000, in microseconds
#commit_siblings = 5 # range 1-1000

# - Checkpoints -

#checkpoint_segments = 3 # in logfile segments, min 1, 16MB each
#checkpoint_timeout = 5min # range 30s-1h
#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
#checkpoint_warning = 30s # 0 disables

# - Archiving -

#archive_mode = off # allows archiving to be done
                # (Change requires restart)
#archive_command = '' # command to use to archive a logfile segment
                # Placeholders:% p = path of file to archive
                #% F = file name only
                # E.g. 'test! -f / Mnt / server / archivedir /% f && cp% p / mnt / server / archivedir /% f'
#archive_timeout = 0 # force a logfile segment switch after this
                # Number of seconds; 0 disables


# ------------------------------------------------- -----------------------------
# REPLICATION
# ------------------------------------------------- -----------------------------

# - Sending Server (s) -

# Set these on the master and on any standby that will send replication data.

#max_wal_senders = 0 # max number of walsender processes
                # (Change requires restart)
#wal_keep_segments = 0 # in logfile segments, 16MB each; 0 disables
#wal_sender_timeout = 60s # in milliseconds; 0 disables

# - Master Server -

# These settings are ignored on a standby server.

#synchronous_standby_names = '' # standby servers that provide sync rep
                # Comma-separated list of application_name
                # From standby (s); '*' = all
#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed

# - Standby Servers -

# These settings are ignored on a master server.

#hot_standby = off # "on" allows queries during recovery
                    # (Change requires restart)
#max_standby_archive_delay = 30s # max delay before canceling queries
                    # When reading WAL from archive;
                    # -1 Allows indefinite delay
#max_standby_streaming_delay = 30s # max delay before canceling queries
                    # When reading streaming WAL;
                    # -1 Allows indefinite delay
#wal_receiver_status_interval = 10s # send replies at least this often
                    # 0 disables
#hot_standby_feedback = off # send info from standby to prevent
                    # Query conflicts
#wal_receiver_timeout = 60s # time that receiver waits for
                    # Communication from master
                    # In milliseconds; 0 disables

# ------------------------------------------------- -----------------------------
# QUERY TUNING
# ------------------------------------------------- -----------------------------

# - Planner Method Configuration -

#enable_bitmapscan = on
#enable_hashagg = on
#enable_hashjoin = on
#enable_indexscan = on
#enable_indexonlyscan = on
#enable_material = on
#enable_mergejoin = on
#enable_nestloop = on
#enable_seqscan = on
#enable_sort = on
#enable_tidscan = on

# - Planner Cost Constants -

#seq_page_cost = 1.0 # measured on an arbitrary scale
#random_page_cost = 4.0 # same scale as above
#cpu_tuple_cost = 0.01 # same scale as above
#cpu_index_tuple_cost = 0.005 # same scale as above
#cpu_operator_cost = 0.0025 # same scale as above
#effective_cache_size = 128MB

# - Genetic Query Optimizer -

#geqo = on
#geqo_threshold = 12
#geqo_effort = 5 # range 1-10
#geqo_pool_size = 0 # selects default based on effort
#geqo_generations = 0 # selects default based on effort
#geqo_selection_bias = 2.0 # range 1.5-2.0
#geqo_seed = 0.0 # range 0.0-1.0

# - Other Planner Options -

#default_statistics_target = 100 # range 1-10000
#constraint_exclusion = partition # on, off, or partition
#cursor_tuple_fraction = 0.1 # range 0.0-1.0
#from_collapse_limit = 8
#join_collapse_limit = 8 # 1 disables collapsing of explicit
                    # JOIN clauses


# ------------------------------------------------- -----------------------------
# ERROR REPORTING AND LOGGING
# ------------------------------------------------- -----------------------------

# - Where to Log -

#log_destination = 'stderr' # Valid values are combinations of
                    # Stderr, csvlog, syslog, and eventlog,
                    # Depending on platform. Csvlog
                    # Requires logging_collector to be on.

# This is used when logging to stderr:
#logging_collector = off # Enable capturing of stderr and csvlog
                    # Into log files. Required to be on for
                    # Csvlogs.
                    # (Change requires restart)

# These are only used if logging_collector is on:
#log_directory = 'pg_log' # directory where log files are written,
                    # Can be absolute or relative to PGDATA
#log_filename = 'postgresql-% Y-% m-% d_% H% M% S.log' # log file name pattern,
                    # Can include strftime () escapes
#log_file_mode = 0600 # creation mode for log files,
                    # Begin with 0 to use octal notation
#log_truncate_on_rotation = off # If on, an existing log file with the
                    # Same name as the new log file will be
                    # Truncated rather than appended to.
                    # But such truncation only occurs on
                    # Time-driven rotation, not on restarts
                    # Or size-driven rotation. Default is
                    # Off, meaning append to existing files
                    # In all cases.
#log_rotation_age = 1d # Automatic rotation of logfiles will
                    # Happen after that time. 0 disables.
#log_rotation_size = 10MB # Automatic rotation of logfiles will
                    # Happen after that much log output.
                    # 0 disables.

# These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'

# This is only relevant when logging to eventlog (win32):
#event_source = 'PostgreSQL'

# - When to Log -

#client_min_messages = notice # values in order of decreasing detail:
                    # Debug5
                    # Debug4
                    # Debug3
                    # Debug2
                    # Debug1
                    # Log
                    # Notice
                    # Warning
                    # Error

#log_min_messages = warning # values in order of decreasing detail:
                    # Debug5
                    # Debug4
                    # Debug3
                    # Debug2
                    # Debug1
                    # Info
                    # Notice
                    # Warning
                    # Error
                    # Log
                    # Fatal
                    # Panic

#log_min_error_statement = error # values in order of decreasing detail:
                    # Debug5
                    # Debug4
                    # Debug3
                    # Debug2
                    # Debug1
                    # Info
                    # Notice
                    # Warning
                    # Error
                    # Log
                    # Fatal
                    # Panic (effectively off)

#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
                    # And their durations,> 0 logs only
                    # Statements running at least this number
                    # Of milliseconds


# - What to Log -

#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
#debug_pretty_print = on
#log_checkpoints = off
#log_connections = off
#log_disconnections = off
#log_duration = off
#log_error_verbosity = default # terse, default, or verbose messages
#log_hostname = off
log_line_prefix = '% t' # special values:
                    #% A = application name
                    #% U = user name
                    #% D = database name
                    #% R = remote host and port
                    #% H = remote host
                    #% P = process ID
                    #% T = timestamp without milliseconds
                    #% M = timestamp with milliseconds
                    #% I = command tag
                    #% E = SQL state
                    #% C = session ID
                    #% L = session line number
                    #% S = session start timestamp
                    #% V = virtual transaction ID
                    #% X = transaction ID (0 if none)
                    #% Q = stop here in non-session
                    # Processes
                    # %% = '%'
                    # E.g. '<% u %%% d>'
#log_lock_waits = off # log lock waits> = deadlock_timeout
#log_statement = 'none' # none, ddl, mod, all
#log_temp_files = -1 # log temporary files equal or larger
                    # Than the specified size in kilobytes;
                    # -1 Disables, 0 logs all temp files
log_timezone = 'PRC'


# ------------------------------------------------- -----------------------------
# RUNTIME STATISTICS
# ------------------------------------------------- -----------------------------

# - Query / Index Statistics Collector -

#track_activities = on
#track_counts = on
#track_io_timing = off
#track_functions = none # none, pl, all
#track_activity_query_size = 1024 # (change requires restart)
#update_process_title = on
#stats_temp_directory = 'pg_stat_tmp'


# - Statistics Monitoring -

#log_parser_stats = off
#log_planner_stats = off
#log_executor_stats = off
#log_statement_stats = off


# ------------------------------------------------- -----------------------------
# AUTOVACUUM PARAMETERS
# ------------------------------------------------- -----------------------------

#autovacuum = on # Enable autovacuum subprocess? 'on'
                    # Requires track_counts to also be on.
#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and
                    # Their durations,> 0 logs only
                    # Actions running at least this number
                    # Of milliseconds.
#autovacuum_max_workers = 3 # max number of autovacuum subprocesses
                    # (Change requires restart)
#autovacuum_naptime = 1min # time between autovacuum runs
#autovacuum_vacuum_threshold = 50 # min number of row updates before
                    # Vacuum
#autovacuum_analyze_threshold = 50 # min number of row updates before
                    # Analyze
#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
                    # (Change requires restart)
#autovacuum_multixact_freeze_max_age = 400000000 # maximum Multixact age
                    # Before forced vacuum
                    # (Change requires restart)
#autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for
                    # Autovacuum, in milliseconds;
                    # -1 Means use vacuum_cost_delay
#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for
                    # Autovacuum, -1 means use
                    # Vacuum_cost_limit


# ------------------------------------------------- -----------------------------
# CLIENT CONNECTION DEFAULTS
# ------------------------------------------------- -----------------------------

# - Statement Behavior -

#search_path = ' "$ user", public' # schema names
#default_tablespace = '' # a tablespace name, '' uses the default
#temp_tablespaces = '' # a list of tablespace names, '' uses
                    # Only default tablespace
#check_function_bodies = on
#default_transaction_isolation = 'read committed'
#default_transaction_read_only = off
#default_transaction_deferrable = off
#session_replication_role = 'origin'
#statement_timeout = 0 # in milliseconds, 0 is disabled
#lock_timeout = 0 # in milliseconds, 0 is disabled
#vacuum_freeze_min_age = 50000000
#vacuum_freeze_table_age = 150000000
#vacuum_multixact_freeze_min_age = 5000000
#vacuum_multixact_freeze_table_age = 150000000
#bytea_output = 'hex' # hex, escape
#xmlbinary = 'base64'
#xmloption = 'content'

# - Locale and Formatting -

datestyle = 'iso, ymd'
#intervalstyle = 'postgres'
timezone = 'PRC'
#timezone_abbreviations = 'Default' # Select the set of available time zone
                    # Abbreviations. Currently, there are
                    # Default
                    # Australia
                    # India
                    # You can create your own file in
                    # Share / timezonesets /.
#extra_float_digits = 0 # min -15, max 3
#client_encoding = sql_ascii # actually, defaults to database
                    # Encoding

# These settings are initialized by initdb, but they can be changed.
lc_messages = 'zh_CN.UTF-8' # locale for system error message
                    # Strings
lc_monetary = 'zh_CN' # locale for monetary formatting
lc_numeric = 'zh_CN' # locale for number formatting
lc_time = 'zh_CN' # locale for time formatting

# Default configuration for text search
default_text_search_config = 'pg_catalog.simple'

# - Other Defaults -

#dynamic_library_path = '$ libdir'
#local_preload_libraries = ''


# ------------------------------------------------- -----------------------------
# LOCK MANAGEMENT
# ------------------------------------------------- -----------------------------

#deadlock_timeout = 1s
#max_locks_per_transaction = 64 # min 10
                    # (Change requires restart)
# Note: Each lock table slot uses ~ 270 bytes of shared memory, and there are
# Max_locks_per_transaction * (max_connections + max_prepared_transactions)
# Lock table slots.
#max_pred_locks_per_transaction = 64 # min 10
                    # (Change requires restart)


# ------------------------------------------------- -----------------------------
# VERSION / PLATFORM COMPATIBILITY
# ------------------------------------------------- -----------------------------

# - Previous PostgreSQL Versions -

#array_nulls = on
#backslash_quote = safe_encoding # on, off, or safe_encoding
#default_with_oids = off
#escape_string_warning = on
#lo_compat_privileges = off
#quote_all_identifiers = off
#sql_inheritance = on
#standard_conforming_strings = on
#synchronize_seqscans = on

# - Other Platforms and Clients -

#transform_null_equals = off


# ------------------------------------------------- -----------------------------
# ERROR HANDLING
# ------------------------------------------------- -----------------------------

#exit_on_error = off # terminate session on any error?
#restart_after_crash = on # reinitialize after backend crash?


# ------------------------------------------------- -----------------------------
# CONFIG FILE INCLUDES
# ------------------------------------------------- -----------------------------

# These options allow settings to be loaded from files other than the
# Default postgresql.conf.

#include_dir = 'conf.d' # include files ending in '.conf' from
                    # Directory 'conf.d'
#include_if_exists = 'exists.conf' # include file only if it exists
#include = 'special.conf' # include file


# ------------------------------------------------- -----------------------------
# CUSTOMIZED OPTIONS
# ------------------------------------------------- -----------------------------

# Add settings for extensions here

08, modify the database configuration file pg_hba.conf PostgresSQL

vi /etc/postgresql/9.3/main/pg_hba.conf

Profile before modification

# PostgreSQL Client Authentication Configuration File
# ================================================= ==
#
# Refer to the "Client Authentication" section in the PostgreSQL
# Documentation for a complete description of this file. A short
# Synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# Are authenticated, which PostgreSQL user names they can use, which
. # Databases they can access Records take one of these forms:
#
# Local DATABASE USER METHOD [OPTIONS]
# Host DATABASE USER ADDRESS METHOD [OPTIONS]
# Hostssl DATABASE USER ADDRESS METHOD [OPTIONS]
# Hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain
# Socket, "host" is either a plain or SSL-encrypted TCP / IP socket,
# "Hostssl" is an SSL-encrypted TCP / IP socket, and "hostnossl" is a
# Plain TCP / IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", "replication", a
# Database name, or a comma-separated list thereof. The "all"
# Keyword does not match "replication". Access to replication
# Must be enabled in a separate record (see example below).
#
# USER can be "all", a user name, a group name prefixed with "+", or a
# Comma-separated list thereof. In both the DATABASE and USER fields
# You can also write a file name prefixed with "@" to include names
# From a separate file.
#
# ADDRESS specifies the set of hosts the record matches. It can be a
# Host name, or it is made up of an IP address and a CIDR mask that is
# An integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
# Specifies the number of significant bits in the mask. A host name
# That starts with a dot (.) Matches a suffix of the actual host name.
# Alternatively, you can write an IP address and netmask in separate
# Columns to specify the set of hosts. Instead of a CIDR-address, you
# Can write "samehost" to match any of the server's own IP addresses,
# Or "samenet" to match any address in any subnet that the server is
# Directly connected to.
#
# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
# "Krb5", "ident", "peer", "pam", "ldap", "radius" or "cert". Note that
# "Password" sends passwords in clear text; "md5" is preferred since
# Sends encrypted passwords.
#
# OPTIONS are a set of options for the authentication in the format
# NAME = VALUE. The available options depend on the different
# Authentication methods - refer to the "Client Authentication"
# Section in the documentation for a list of which options are
# Available for which authentication methods.
#
# Database and user names containing spaces, commas, quotes and other
# Special characters must be quoted. Quoting one of the keywords
# "All", "sameuser", "samerole" or "replication" makes the name lose
# Its special character, and just match a database or username with
# That name.
#
# This file is read on server startup and when the postmaster receives
# A SIGHUP signal. If you edit the file on a running system, you have
# To SIGHUP the postmaster for the changes to take effect. You can
# Use "pg_ctl reload" to do that.

# Put your actual configuration here
---------------------------------- #
#
# If you want to allow non-local connections, you need to add more
# "Host" records. In that case you will also need to make PostgreSQL
# Listen on a non-local interface via the listen_addresses
# Configuration parameter, or via the -i or -h command line switches.

 


# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# Database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# Maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
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 127.0.0.1/32 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

The modified configuration file

# PostgreSQL Client Authentication Configuration File
# ================================================= ==
#
# Refer to the "Client Authentication" section in the PostgreSQL
# Documentation for a complete description of this file. A short
# Synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# Are authenticated, which PostgreSQL user names they can use, which
. # Databases they can access Records take one of these forms:
#
# Local DATABASE USER METHOD [OPTIONS]
# Host DATABASE USER ADDRESS METHOD [OPTIONS]
# Hostssl DATABASE USER ADDRESS METHOD [OPTIONS]
# Hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain
# Socket, "host" is either a plain or SSL-encrypted TCP / IP socket,
# "Hostssl" is an SSL-encrypted TCP / IP socket, and "hostnossl" is a
# Plain TCP / IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", "replication", a
# Database name, or a comma-separated list thereof. The "all"
# Keyword does not match "replication". Access to replication
# Must be enabled in a separate record (see example below).
#
# USER can be "all", a user name, a group name prefixed with "+", or a
# Comma-separated list thereof. In both the DATABASE and USER fields
# You can also write a file name prefixed with "@" to include names
# From a separate file.
#
# ADDRESS specifies the set of hosts the record matches. It can be a
# Host name, or it is made up of an IP address and a CIDR mask that is
# An integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
# Specifies the number of significant bits in the mask. A host name
# That starts with a dot (.) Matches a suffix of the actual host name.
# Alternatively, you can write an IP address and netmask in separate
# Columns to specify the set of hosts. Instead of a CIDR-address, you
# Can write "samehost" to match any of the server's own IP addresses,
# Or "samenet" to match any address in any subnet that the server is
# Directly connected to.
#
# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
# "Krb5", "ident", "peer", "pam", "ldap", "radius" or "cert". Note that
# "Password" sends passwords in clear text; "md5" is preferred since
# Sends encrypted passwords.
#
# OPTIONS are a set of options for the authentication in the format
# NAME = VALUE. The available options depend on the different
# Authentication methods - refer to the "Client Authentication"
# Section in the documentation for a list of which options are
# Available for which authentication methods.
#
# Database and user names containing spaces, commas, quotes and other
# Special characters must be quoted. Quoting one of the keywords
# "All", "sameuser", "samerole" or "replication" makes the name lose
# Its special character, and just match a database or username with
# That name.
#
# This file is read on server startup and when the postmaster receives
# A SIGHUP signal. If you edit the file on a running system, you have
# To SIGHUP the postmaster for the changes to take effect. You can
# Use "pg_ctl reload" to do that.

# Put your actual configuration here
---------------------------------- #
#
# If you want to allow non-local connections, you need to add more
# "Host" records. In that case you will also need to make PostgreSQL
# Listen on a non-local interface via the listen_addresses
# Configuration parameter, or via the -i or -h command line switches.

 


# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# Database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# Maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
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 127.0.0.1/32 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
# To allow your client visiting postgresql server
host all all 0.0.0.0 0.0.0.0 md5

The last line indicates the permissible type of host is the host; the first is to allow access to all the database name; the second is to allow all users; 0.0.0.0 The first is to allow access to IP Address; the second is to allow access SubNet Mask 0.0.0.0 ; finally md5 password encryption method indicates if the md5 into trust, when you specify a range of hosts to access the database without having to provide a password.

IP Address and SubNet Mask entries can also be modified for your machine IP address (for example: 10.13.19.53) and subnet mask (for example: 255.255.255.255), so that only your own host before remote access to the database. To use a range of IP addresses, just put SubNet Mask set to the appropriate value.

If the SubNet Mask set to 0.0.0.0, all hosts can access the database (IP Address can be set). If md5 into trust, allowing host access to the specified range without providing a password when the specified database.

09, restart PostgresSQL 9.3.5

root: # /etc/init.d/postgresql restart
 * Restarting PostgreSQL 9.3 database server [OK]
root: #

10, landing test PostgresSQL 9.3.5

root: # psql -U postgres -h 127.0.0.1
Password for user postgres: postgres database user password set in step # on
psql (9.3.5)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

postgres = # \ q
could not save history to file "/root/.psql_history": No such file or directory # log back in it, because the first file does not exist
root: # psql -U postgres -h 127.0.0.1
Password for user postgres: postgres database user password set in step # on
psql (9.3.5)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

postgres = # \ q
root: #
     
         
         
         
  More:      
 
- Vim simple configuration (Linux)
- Deploy OpenStack Juno on Ubuntu 14.04 (Linux)
- Java uses JDBC connect database (Programming)
- Java Set and List in the relationship and difference (Programming)
- CentOS 6.7 compile and install LAMP (Server)
- Make Linux more secure server tips (Linux)
- How to use the command line to obtain Freely RSS source on Linux (Linux)
- Linux operating system security settings initial understanding (Linux)
- Linux iptables: Composition Rules (Linux)
- OpenVPN offsite interconnecting room availability and load balancing solution (Server)
- Using Libreoffice under ubuntu (Linux)
- Java rewrite equals method (Programming)
- ActiveMQ5.11.1 and JDK version matching relation (Linux)
- The Concept and Semantics of Java Memory Model (Programming)
- Ubuntu modify DNS restart loss problem (Linux)
- Use Tmux and Vim to make IDE (Linux)
- Linux protobuf-c (Linux)
- Some security configuration of Linux systems (Linux)
- MyCAT separate read and write to achieve MySQL Practice (Database)
- Circular list of Java programming (Programming)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.