Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2017
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.34 KB | None | 0 0
  1. user: postgres
  2. password: postgres
  3. host: 192.168.99.100
  4. port: 5432
  5. database: test_db
  6.  
  7. var pg = require('pg');
  8. var conString =
  9. "postgres://postgres:postgres@192.168.99.100:5432/test_db";
  10.  
  11. var client = new pg.Client(conString);
  12. client.connect();
  13.  
  14. psql -U postgres -d test_db -h 192.168.99.100 -W
  15.  
  16. # TYPE DATABASE USER ADDRESS METHOD
  17.  
  18. # "local" is for Unix domain socket connections only
  19. local all all trust
  20. # IPv4 local connections:
  21. host all all 127.0.0.1/32 trust
  22. # IPv6 local connections:
  23. host all all ::1/128 trust
  24. # Allow replication connections from localhost, by a user with the
  25. # replication privilege.
  26. #local replication postgres trust
  27. #host replication postgres 127.0.0.1/32 trust
  28. #host replication postgres ::1/128 trust
  29.  
  30. host all all all md5
  31.  
  32. #------------------------------------------------------------------------------
  33. # CONNECTIONS AND AUTHENTICATION
  34. #------------------------------------------------------------------------------
  35.  
  36. # - Connection Settings -
  37.  
  38. listen_addresses = '*' # comma-separated list of addresses;
  39. # defaults to 'localhost'; use '*' for all
  40. # (change requires restart)
  41. #port = 5432 # (change requires restart)
  42. max_connections = 100 # (change requires restart)
  43. #superuser_reserved_connections = 3 # (change requires restart)
  44. #unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
  45. # (change requires restart)
  46. #unix_socket_group = '' # (change requires restart)
  47. #unix_socket_permissions = 0777 # begin with 0 to use octal notation
  48. # (change requires restart)
  49. #bonjour = off # advertise server via Bonjour
  50. # (change requires restart)
  51. #bonjour_name = '' # defaults to the computer name
  52. # (change requires restart)
  53.  
  54. # - Security and Authentication -
  55.  
  56. #authentication_timeout = 1min # 1s-600s
  57. #ssl = off # (change requires restart)
  58. #ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers
  59. # (change requires restart)
  60. #ssl_prefer_server_ciphers = on # (change requires restart)
  61. #ssl_ecdh_curve = 'prime256v1' # (change requires restart)
  62. #ssl_cert_file = 'server.crt' # (change requires restart)
  63. #ssl_key_file = 'server.key' # (change requires restart)
  64. #ssl_ca_file = '' # (change requires restart)
  65. #ssl_crl_file = '' # (change requires restart)
  66. #password_encryption = on
  67. #db_user_namespace = off
  68. #row_security = on
  69.  
  70. # GSSAPI using Kerberos
  71. #krb_server_keyfile = ''
  72. #krb_caseins_users = off
  73.  
  74. # - TCP Keepalives -
  75. # see "man 7 tcp" for details
  76.  
  77. #tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
  78. # 0 selects the system default
  79. #tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
  80. # 0 selects the system default
  81. #tcp_keepalives_count = 0 # TCP_KEEPCNT;
  82. # 0 selects the system default
  83.  
  84. host all all all md5
  85.  
  86. host all all 0.0.0.0/0 md5
  87.  
  88. host all all 192.168.0.0/16 md5
  89.  
  90. host all all 172.17.0.0/16 md5
  91.  
  92. host all all 192.168.99.0/24 md5
  93.  
  94. host all all 0.0.0.0/0 md5
  95.  
  96. docker pull postgres
  97.  
  98. docker run --name pg -p 5432:5432 -e POSTGRES_PASSWORD=passwrd -e POSTGRES_USER=root -e POSTGRES_DB=dse -d postgres
  99.  
  100. docker exec -ti pg /bin/bash
  101.  
  102. psql -U root -d dse -h 192.168.99.100 -W
  103. Password for user root:
  104. psql (9.6.2)
  105. Type "help" for help.
  106.  
  107. dse=#
  108.  
  109. var pg = require('pg');
  110.  
  111. var conString = "postgres://root:passwrd@192.168.99.100/dse";
  112. var client = new pg.Client(conString);
  113. client.connect();
  114.  
  115. node connect.js
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement