You can now start the database server using: Initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or -auth-local and -auth-host, the next time you run initdb. Initdb: warning: enabling "trust" authentication for local connections Performing post-bootstrap initialization. Selecting dynamic shared memory implementation. The default text search configuration will be set to "english".Ĭreating directory /var/lib/postgres/data. The database cluster will be initialized with locale "C.UTF-8". This user must also own the server process. The files belonging to this database system will be owned by user "postgres". Many lines should now appear on the screen with several ending by. $ initdb -locale=C.UTF-8 -encoding=UTF8 -D /var/lib/postgres/data -data-checksums For more options, see initdb -help and official documentation.You can use -auth-local=peer -auth-host=scram-sha-256 for safer authentication methods. The trust authentication method is used by default, meaning that anyone on the host can connect as any database user.(Once the database is up, you can check if it is enabled with $ psql -c "SHOW data_checksums".) Read #Enable data checksumming for more information. If your data directory resides on a file system without data checksumming, you may wish to enable PostgreSQL's built-in checksumming for increased integrity guarantees - add the -data-checksums argument to do so.Restart the server for the changes to take effect.Note: Using a locale other than C.UTF-8, C, POSIX or ucs_basic can result in a collation version mismatch that will require reindexing if the library providing the locale ( glibc or icu) gets updated. Omit both of these options to disable TCP/ IP connections. Use ‘*’ to listen on all interfaces on the host, specify a single host name or IP address to listen on a single interface, or separate several hostname or IP addresses by space (such as ‘10.10.0.1 10.11.0.1’). Use the port option with the listen_addresses option to control the interface where the port will be listening. The default port number is 5432but you can change it as required. The port option sets the PostgreSQL server port number that will be used when listening for TCP/ IP connections. service postgresql restart Setting or changing the TCP port Restart the server for the changes to take effect. unix_socket_directory= /var/run/postgresql/ Remove or comment (#) the line to disable socket access. Specify a filesystem directory path, usually /var/run/postgresql/ and the socket will be created when the server next starts. The unix_socket_directory option indicates the filesystem path to the location of the directory you’d like to hold your socket. vi /etc/postgresql/9.5/main/nf Configuring local socket use (Linux/ Unix only) ![]() I’m using Linux for this example, but adjust the following steps to suit your environment. On Windows it’s usually C:\Program Files\PostgreSQL\9.5\data but again, you’ll have to take the version into account. In Linux you can use the following command to find the file: locate nfĪs you can see, the server version is included in the file path so you’ll need to check that before trying to open it. PostgreSQL Server can be configured to use a local socket, TCP connections or both.īe editing the nf file for the following sections however the location of the file is different depending on OS and PostgreSQL version. It incurs a small penalty over a local socket and therefore slightly higher latencies and is limited by the network bandwidth available. In larger or highly available systems this may not be possible.Ī TCP connection is the only option of connecting to your PostgreSQL database server from a remote machine. This comes with the limitation that it can only be used if the application accessing the database is on the same machine. In addition to a TCP listening port, PostgreSQL will also a local socket if the server is running in a Linux/ Unix environment. A local socket is the prefered method of connecting to a database as it removes much of the overhead of creating a TCP connection and transferring data. ![]() ![]() ![]() The default TCP port for PostgreSQL is usually 5432, however this can easily be changed in the nf configuration file, which is the main configuration file for the database server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |