ubuntu 18.04.1 LTS postgres systemd service












0














I am installing Postgres 11 on Ubuntu 18.04. When you do a non-default install:



First install postgresql-common. Adapt the config file to NOT create main cluster , start_conf= 'auto' and data_directory = '/pgs002/%v/%c'



Install postgresql-11, contrib and postgresql-11-postgis-2.5
Then you create a cluster with pg_createcluster.



There are two problems:





  1. The DB does not start. (because the pg_hba_conf etc are in /etc/postgres... and not in /pgs002/11/cluster/data).



    This is easy to fix, just copy the conf files to the right places.



  2. The service is not created or not created in the correct way. There are two postgresql files in /lib/systemd/system, postgresql.service and postgresql@.service. The latter's file size is 1580, the former's 337. The latter seems to be correct, (contents of the file) but not the name. There is no service created for the cluster.


How can I fix this problem?










share|improve this question





























    0














    I am installing Postgres 11 on Ubuntu 18.04. When you do a non-default install:



    First install postgresql-common. Adapt the config file to NOT create main cluster , start_conf= 'auto' and data_directory = '/pgs002/%v/%c'



    Install postgresql-11, contrib and postgresql-11-postgis-2.5
    Then you create a cluster with pg_createcluster.



    There are two problems:





    1. The DB does not start. (because the pg_hba_conf etc are in /etc/postgres... and not in /pgs002/11/cluster/data).



      This is easy to fix, just copy the conf files to the right places.



    2. The service is not created or not created in the correct way. There are two postgresql files in /lib/systemd/system, postgresql.service and postgresql@.service. The latter's file size is 1580, the former's 337. The latter seems to be correct, (contents of the file) but not the name. There is no service created for the cluster.


    How can I fix this problem?










    share|improve this question



























      0












      0








      0







      I am installing Postgres 11 on Ubuntu 18.04. When you do a non-default install:



      First install postgresql-common. Adapt the config file to NOT create main cluster , start_conf= 'auto' and data_directory = '/pgs002/%v/%c'



      Install postgresql-11, contrib and postgresql-11-postgis-2.5
      Then you create a cluster with pg_createcluster.



      There are two problems:





      1. The DB does not start. (because the pg_hba_conf etc are in /etc/postgres... and not in /pgs002/11/cluster/data).



        This is easy to fix, just copy the conf files to the right places.



      2. The service is not created or not created in the correct way. There are two postgresql files in /lib/systemd/system, postgresql.service and postgresql@.service. The latter's file size is 1580, the former's 337. The latter seems to be correct, (contents of the file) but not the name. There is no service created for the cluster.


      How can I fix this problem?










      share|improve this question















      I am installing Postgres 11 on Ubuntu 18.04. When you do a non-default install:



      First install postgresql-common. Adapt the config file to NOT create main cluster , start_conf= 'auto' and data_directory = '/pgs002/%v/%c'



      Install postgresql-11, contrib and postgresql-11-postgis-2.5
      Then you create a cluster with pg_createcluster.



      There are two problems:





      1. The DB does not start. (because the pg_hba_conf etc are in /etc/postgres... and not in /pgs002/11/cluster/data).



        This is easy to fix, just copy the conf files to the right places.



      2. The service is not created or not created in the correct way. There are two postgresql files in /lib/systemd/system, postgresql.service and postgresql@.service. The latter's file size is 1580, the former's 337. The latter seems to be correct, (contents of the file) but not the name. There is no service created for the cluster.


      How can I fix this problem?







      systemd postgresql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 12 at 9:59









      Zanna

      50k13131238




      50k13131238










      asked Dec 12 at 8:24









      Herwig Goemans

      13




      13






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I think I can answer my own question after some: when you create a PG cluster this way, you have to enable the service yourself: sudo systemctl enable postgresql@version-cluster name.
          After that, the symlinks are created and you can manage the instance with the service file.






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1100247%2fubuntu-18-04-1-lts-postgres-systemd-service%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I think I can answer my own question after some: when you create a PG cluster this way, you have to enable the service yourself: sudo systemctl enable postgresql@version-cluster name.
            After that, the symlinks are created and you can manage the instance with the service file.






            share|improve this answer


























              0














              I think I can answer my own question after some: when you create a PG cluster this way, you have to enable the service yourself: sudo systemctl enable postgresql@version-cluster name.
              After that, the symlinks are created and you can manage the instance with the service file.






              share|improve this answer
























                0












                0








                0






                I think I can answer my own question after some: when you create a PG cluster this way, you have to enable the service yourself: sudo systemctl enable postgresql@version-cluster name.
                After that, the symlinks are created and you can manage the instance with the service file.






                share|improve this answer












                I think I can answer my own question after some: when you create a PG cluster this way, you have to enable the service yourself: sudo systemctl enable postgresql@version-cluster name.
                After that, the symlinks are created and you can manage the instance with the service file.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 19 at 9:02









                Herwig Goemans

                13




                13






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1100247%2fubuntu-18-04-1-lts-postgres-systemd-service%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                    Eduardo VII do Reino Unido