Advertisement
Guest User

Untitled

a guest
Aug 10th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.73 KB | None | 0 0
  1. Started GET "/" for 127.0.0.1 at 2013-11-06 23:56:36 -0500
  2.  
  3. PG::ConnectionBad - could not connect to server: Connection refused
  4. Is the server running on host "localhost" (::1) and accepting
  5. TCP/IP connections on port 5432?
  6. could not connect to server: Connection refused
  7. Is the server running on host "localhost" (127.0.0.1) and accepting
  8. TCP/IP connections on port 5432?
  9. could not connect to server: Connection refused
  10. Is the server running on host "localhost" (fe80::1) and accepting
  11. TCP/IP connections on port 5432?
  12. :
  13. activerecord (4.0.0) lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `connect'
  14. activerecord (4.0.0) lib/active_record/connection_adapters/postgresql_adapter.rb:542:in `initialize'
  15. activerecord (4.0.0) lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
  16. activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection'
  17. activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection'
  18. activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `acquire_connection'
  19. activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout'
  20. /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
  21. activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout'
  22. activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
  23. /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
  24. activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
  25. activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
  26. activerecord (4.0.0) lib/active_record/connection_handling.rb:79:in `retrieve_connection'
  27. activerecord (4.0.0) lib/active_record/connection_handling.rb:53:in `connection'
  28. activerecord (4.0.0) lib/active_record/migration.rb:792:in `current_version'
  29. activerecord (4.0.0) lib/active_record/migration.rb:800:in `needs_migration?'
  30. activerecord (4.0.0) lib/active_record/migration.rb:379:in `check_pending!'
  31. activerecord (4.0.0) lib/active_record/migration.rb:366:in `call'
  32. actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  33. activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__1613334440513032208__call__callbacks'
  34. activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
  35. actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  36. actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
  37. actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
  38. better_errors (0.9.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
  39. better_errors (0.9.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
  40. better_errors (0.9.0) lib/better_errors/middleware.rb:56:in `call'
  41. actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  42. actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  43. railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
  44. railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
  45. activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  46. activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
  47. activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
  48. railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
  49. quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
  50. actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  51. rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  52. rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  53. activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  54. rack (1.5.2) lib/rack/lock.rb:17:in `call'
  55. actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
  56. railties (4.0.0) lib/rails/engine.rb:511:in `call'
  57. railties (4.0.0) lib/rails/application.rb:97:in `call'
  58. rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  59. thin (1.5.1) lib/thin/connection.rb:81:in `block in pre_process'
  60. thin (1.5.1) lib/thin/connection.rb:79:in `pre_process'
  61. thin (1.5.1) lib/thin/connection.rb:54:in `process'
  62. thin (1.5.1) lib/thin/connection.rb:39:in `receive_data'
  63. eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
  64. thin (1.5.1) lib/thin/backends/base.rb:63:in `start'
  65. thin (1.5.1) lib/thin/server.rb:159:in `start'
  66. rack (1.5.2) lib/rack/handler/thin.rb:16:in `run'
  67. rack (1.5.2) lib/rack/server.rb:264:in `start'
  68. railties (4.0.0) lib/rails/commands/server.rb:84:in `start'
  69. railties (4.0.0) lib/rails/commands.rb:78:in `block in <top (required)>'
  70. railties (4.0.0) lib/rails/commands.rb:73:in `<top (required)>'
  71. bin/rails:4:in `<main>'
  72.  
  73. development:
  74. adapter: postgresql
  75. encoding: unicode
  76. database: metals-directory_development
  77. pool: 5
  78. username:
  79. password:
  80. template: template0
  81. host: localhost
  82. port: 5432
  83.  
  84. test: &test
  85. adapter: postgresql
  86. encoding: unicode
  87. database: metals-directory_test
  88. pool: 5
  89. username:
  90. password:
  91. template: template0
  92. host: localhost
  93. port: 5432
  94.  
  95. staging:
  96. adapter: postgresql
  97. encoding: unicode
  98. database: metals-directory_production
  99. pool: 5
  100. username:
  101. password:
  102. template: template0
  103. host: localhost
  104.  
  105. production:
  106. adapter: postgresql
  107. encoding: unicode
  108. database: metals-directory_production
  109. pool: 5
  110. username:
  111. password:
  112. template: template0
  113. host: localhost
  114.  
  115. cucumber:
  116. <<: *test
  117.  
  118. launchctl unload homebrew.mxcl.postgresql.plist
  119. launchctl load -w homebrew.mxcl.postgresql.plist
  120.  
  121. brew services restart postgresql
  122.  
  123. sudo service postgresql restart
  124.  
  125. which psql
  126. #=> /usr/bin/psql
  127.  
  128. sudo su - postgres
  129. psql
  130.  
  131. postgres=#
  132.  
  133. CREATE USER yourname WITH PASSWORD 'passwordhere';
  134. CREATE DATABASE metals-directory_production WITH OWNER yourname;
  135. GRANT ALL PRIVILEGES ON DATABASE metals-directory_production TO yourname;
  136.  
  137. development:
  138. adapter: postgresql
  139. encoding: unicode
  140. database: metals-directory_development
  141. pool: 5
  142. username: yourname
  143. password: passwordhere ### password you have specified within psql
  144. host: localhost
  145. port: 5432 ### you can configure it in file postgresql.conf
  146.  
  147. listen_addresses="localhost"
  148.  
  149. listen_addresses="*"
  150.  
  151. port=5432
  152.  
  153. gem uninstall pg
  154.  
  155. brew uninstall postgres
  156.  
  157. rm -rf /usr/local/var/postgres
  158.  
  159. brew install postgres
  160.  
  161. brew install services
  162.  
  163. brew services start postgresql
  164.  
  165. gem install pg
  166.  
  167. $ brew info postgresql
  168.  
  169. /usr/local/Cellar/postgresql/9.5.4_1 (3,147 files, 35M)
  170. Poured from bottle on 2016-10-14 at 13:33:28
  171. /usr/local/Cellar/postgresql/9.6.1 (3,242 files, 36.4M) *
  172. Poured from bottle on 2017-02-06 at 12:41:00
  173.  
  174. $ cat /usr/local/var/postgres/PG_VERSION
  175. 9.5
  176.  
  177. $ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
  178. # or, with Homebrew...
  179. $ brew services stop postgresql
  180.  
  181. $ initdb /usr/local/var/postgres9.6 -E utf8
  182.  
  183. $ ls /usr/local/Cellar/postgresql/
  184. 9.5.3 9.5.4 9.6.1
  185.  
  186. $ pg_upgrade
  187. -d /usr/local/var/postgres
  188. -D /usr/local/var/postgres9.6
  189. -b /usr/local/Cellar/postgresql/9.5.4/bin/
  190. -B /usr/local/Cellar/postgresql/9.6.1/bin/
  191. -v
  192.  
  193. $ mv /usr/local/var/postgres /usr/local/var/postgres9.5
  194.  
  195. $ mv /usr/local/var/postgres9.6 /usr/local/var/postgres
  196.  
  197. $ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
  198. # or, if you're running a current version of Homebrew
  199. $ brew services start postgresql
  200.  
  201. $ gem uninstall pg
  202. $ gem install pg
  203.  
  204. brew cleanup postgresql
  205.  
  206. rm -rf /usr/local/var/postgres9.5/
  207.  
  208. brew switch postgres 9.3.5 # presuming you already installed 9.4.1
  209. pg_dumpall > outputfile
  210. launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
  211. mv /usr/local/var/postgres /usr/local/var/postgres.old
  212. brew switch postgres 9.4.1
  213. initdb -D /usr/local/var/postgres
  214. psql -d postgres -f outputfile
  215.  
  216. rm outputfile
  217. rm -Rf /usr/local/var/postgres.old
  218.  
  219. kill_postgres() {
  220. if [[ $* -eq "" ]]; then
  221. echo "Usage: 'kill_postgres <db_name>' to kill remaining instances (Eg. 'kill_postgres my_app_development')"
  222. else
  223. gksudo echo "Granted sudo"
  224. pids="$(ps xa | grep postgres | grep $* | awk '{print $1}' | xargs)"
  225. if [[ $pids -eq "" ]]; then
  226. echo "Nothing to kill"
  227. else
  228. for pid in "${pids[@]}"
  229. do
  230. echo "Killing ${pid}"
  231. sudo kill $pid
  232. echo "Killed ${pid}"
  233. done
  234. kill_postgres $*
  235. fi
  236. fi
  237. }
  238.  
  239. bundle exec rake db:migrate RAILS_ENV=production
  240.  
  241. rm postmaster.pid
  242.  
  243. brew services restart postgresql
  244.  
  245. sudo service postgresql restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement