{"id":141,"date":"2011-12-09T14:33:54","date_gmt":"2011-12-09T14:33:54","guid":{"rendered":"http:\/\/blogs.gentoo.org\/titanofold\/?p=141"},"modified":"2011-12-09T14:37:56","modified_gmt":"2011-12-09T14:37:56","slug":"run-varrun-other-or-why-you-need-to-update-to-the-latest-postgresql-initscript","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/titanofold\/2011\/12\/09\/run-varrun-other-or-why-you-need-to-update-to-the-latest-postgresql-initscript\/","title":{"rendered":"\/run? \/var\/run? Other? Or Why You Need to Update to the Latest PostgreSQL Initscript"},"content":{"rendered":"<p>The PostgreSQL ebuilds and initscript are now capable of using either <tt>\/run<\/tt> or <tt>\/var\/run<\/tt> for the default socket directory.<\/p>\n<p>The ebuilds will determine which to use at build time. The logic simply being, &#8220;Does \/run exist?&#8221; If it does, everything is adjusted accordingly. If not, everything is adjusted accordingly. The old initscript is incapable of using <tt>\/run<\/tt> or any other socket directory. So, if you upgrade to the latest version of the ebuilds and fail to upgrade the initscript, you&#8217;re going to have issues if you have a <tt>\/run<\/tt> directory.<\/p>\n<p>Also, this may cause a hiccup when an application is expecting the default location to be in <tt>\/var\/run\/postgresql<\/tt> rather than <tt>\/run\/postgresql<\/tt>. The proper solution is not to rebuild everything &#8212; you can if you want, but that&#8217;s time consuming &#8212; but to specify the directory to look in for the socket. Anywhere you&#8217;d specify the host you can actually specify the socket directory. Or, you should be able to if the application did it right.<\/p>\n<p>Something that is more important for those who have <tt>\/run<\/tt> or <tt>\/var\/run<\/tt> on tmpfs, the initscript now takes care of creating the directory if it&#8217;s missing. With proper permissions of course.<\/p>\n<p>The next neat thing is that the initscript respects two settings it previously ignored. Well, it ignored one setting outright, and allowed you to set another in <tt>\/etc\/conf.d\/postgresql-${SLOT}<\/tt> only. If you set <tt>port<\/tt> or <tt>socket_directory<\/tt> in the <tt>postgresql.conf<\/tt>, the initscript will now pick it up and use those settings over what&#8217;s set in <tt>\/etc\/conf.d\/postgresql-${SLOT}<\/tt>.<\/p>\n<p>The growing pains aren&#8217;t over just yet. Out of three machines, one machine didn&#8217;t like the new initscript. It couldn&#8217;t shutdown an existing, running server. The other two did it just fine. Same setups. Nothing fancy. Just inexplicable. It&#8217;s easy enough to shutdown the server manually, and cleanly. Issue the following substituting the path for wherever your server&#8217;s data directory actually resides.<\/p>\n<pre># kill -SIGTERM $(head -n1 \/var\/lib\/postgresql\/9.1\/data\/postmaster.pid)<\/pre>\n<p>If that doesn&#8217;t do the trick, you can substitute <tt>-SIGTERM<\/tt> with <tt>-SIGINT<\/tt> as that will close client connections and rollback the transactions those clients may have been in, as that is the most common cause as to why <tt>-SIGTERM<\/tt> wouldn&#8217;t work.<\/p>\n<p>Merry Christmas!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The PostgreSQL ebuilds and initscript are now capable of using either \/run or \/var\/run for the default socket directory. The ebuilds will determine which to use at build time. The logic simply being, &#8220;Does \/run exist?&#8221; If it does, everything is adjusted accordingly. If not, everything is adjusted accordingly. The old initscript is incapable of &hellip; <a href=\"https:\/\/blogs.gentoo.org\/titanofold\/2011\/12\/09\/run-varrun-other-or-why-you-need-to-update-to-the-latest-postgresql-initscript\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\/run? \/var\/run? Other? Or Why You Need to Update to the Latest PostgreSQL Initscript<\/span><\/a><\/p>\n","protected":false},"author":136,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[3,5],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1tO5a-2h","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/titanofold\/wp-json\/wp\/v2\/posts\/141"}],"collection":[{"href":"https:\/\/blogs.gentoo.org\/titanofold\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gentoo.org\/titanofold\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/titanofold\/wp-json\/wp\/v2\/users\/136"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/titanofold\/wp-json\/wp\/v2\/comments?post=141"}],"version-history":[{"count":3,"href":"https:\/\/blogs.gentoo.org\/titanofold\/wp-json\/wp\/v2\/posts\/141\/revisions"}],"predecessor-version":[{"id":143,"href":"https:\/\/blogs.gentoo.org\/titanofold\/wp-json\/wp\/v2\/posts\/141\/revisions\/143"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/titanofold\/wp-json\/wp\/v2\/media?parent=141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/titanofold\/wp-json\/wp\/v2\/categories?post=141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/titanofold\/wp-json\/wp\/v2\/tags?post=141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}