How to prevent default MySQL instance starting when mysqld_multi is used?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
2
down vote

favorite












The short version of the problem is that, upon boot, the default mysql startup script starts an unneeded general instance of the server with default settings, followed by mysqld_multi starting the required instances correctly, resulting in too many server instances.



I'm on Ubuntu 14.04. Just upgraded the MySQL Server to version 5.7. I am aiming at running two instances of the MySQL server, one master and one slave, using the same binaries, but other settings being different.



The point of such a setup is to filter tables out of the replication process. Before replicating to a third external instance, controlled by a third party, I want to make sure that only certain tables show up in the binary logs. I have been using this method successfully for years.



After upgrading to MySQL 5.7 my setup looks like this:



[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user = multi_admin
password = multipass

[mysqld1]
server-id = 1
port = 3306
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
...

[mysqld2]
basedir = /usr
server-id = 2
port = 3307
user = mysql
pid-file = /var/run/mysqld/mysqld_blackhole_slave.pid
socket = /var/run/mysqld/mysqld_blackhole_slave.sock
datadir = /var/lib/mysql_blackhole_slave
log-error = /var/log/mysql_blackhole_slave/error.log
...


It is interesting to note that MySQL creates the /var/run/mysqld directory when the server is started, and deletes it when the server is shut down (and no other process is using it).



In my /etc/init.d I have two related startup scripts: mysql and mysqld_multi.



When the mysql script runs, it checks the my.cnf file, finds that there is no [mysqld] group, and therefore, starts a server instance with default settings. It creates the /var/run/mysqld directory, as mentioned above, and gets everything going. At this point I have a server instance running with default values that I did not specify.



Then comes the mysqld_multi script. It looks for groups of [mysqldN] in my.cnf, and starts server instances accordingly. This will start two additional instances according to my specifications. At this point I have three server instances running instead of the two I requested in the configuration file.



If I remove the mysql script from /etc/init.d, the default instance will not start, but neither will the other two because:




mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't
exists. (sic)




Please note, it does not say it was unable to create the directory. It seems to assume the directory should exist at this point, but due to the removal of the mysql startup script, it never gets created. I believe this process does not attempt to create the directory. If it did attempt, one would assume a permission problem. I have disabled apparmor, and I have tried running these processes as root to rule out permission related issues.



I can of course do:



sudo mkdir /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld


and then start mysqld_multi. This works fine, but is a very unorthodox way of starting up your system.



So I am wondering, is there not a proper way of starting mysqld_multi on this present system without hacking the process?







share|improve this question


























    up vote
    2
    down vote

    favorite












    The short version of the problem is that, upon boot, the default mysql startup script starts an unneeded general instance of the server with default settings, followed by mysqld_multi starting the required instances correctly, resulting in too many server instances.



    I'm on Ubuntu 14.04. Just upgraded the MySQL Server to version 5.7. I am aiming at running two instances of the MySQL server, one master and one slave, using the same binaries, but other settings being different.



    The point of such a setup is to filter tables out of the replication process. Before replicating to a third external instance, controlled by a third party, I want to make sure that only certain tables show up in the binary logs. I have been using this method successfully for years.



    After upgrading to MySQL 5.7 my setup looks like this:



    [mysqld_multi]
    mysqld = /usr/bin/mysqld_safe
    mysqladmin = /usr/bin/mysqladmin
    user = multi_admin
    password = multipass

    [mysqld1]
    server-id = 1
    port = 3306
    user = mysql
    pid-file = /var/run/mysqld/mysqld.pid
    socket = /var/run/mysqld/mysqld.sock
    datadir = /var/lib/mysql
    log-error = /var/log/mysql/error.log
    ...

    [mysqld2]
    basedir = /usr
    server-id = 2
    port = 3307
    user = mysql
    pid-file = /var/run/mysqld/mysqld_blackhole_slave.pid
    socket = /var/run/mysqld/mysqld_blackhole_slave.sock
    datadir = /var/lib/mysql_blackhole_slave
    log-error = /var/log/mysql_blackhole_slave/error.log
    ...


    It is interesting to note that MySQL creates the /var/run/mysqld directory when the server is started, and deletes it when the server is shut down (and no other process is using it).



    In my /etc/init.d I have two related startup scripts: mysql and mysqld_multi.



    When the mysql script runs, it checks the my.cnf file, finds that there is no [mysqld] group, and therefore, starts a server instance with default settings. It creates the /var/run/mysqld directory, as mentioned above, and gets everything going. At this point I have a server instance running with default values that I did not specify.



    Then comes the mysqld_multi script. It looks for groups of [mysqldN] in my.cnf, and starts server instances accordingly. This will start two additional instances according to my specifications. At this point I have three server instances running instead of the two I requested in the configuration file.



    If I remove the mysql script from /etc/init.d, the default instance will not start, but neither will the other two because:




    mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't
    exists. (sic)




    Please note, it does not say it was unable to create the directory. It seems to assume the directory should exist at this point, but due to the removal of the mysql startup script, it never gets created. I believe this process does not attempt to create the directory. If it did attempt, one would assume a permission problem. I have disabled apparmor, and I have tried running these processes as root to rule out permission related issues.



    I can of course do:



    sudo mkdir /var/run/mysqld
    sudo chown mysql:mysql /var/run/mysqld


    and then start mysqld_multi. This works fine, but is a very unorthodox way of starting up your system.



    So I am wondering, is there not a proper way of starting mysqld_multi on this present system without hacking the process?







    share|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      The short version of the problem is that, upon boot, the default mysql startup script starts an unneeded general instance of the server with default settings, followed by mysqld_multi starting the required instances correctly, resulting in too many server instances.



      I'm on Ubuntu 14.04. Just upgraded the MySQL Server to version 5.7. I am aiming at running two instances of the MySQL server, one master and one slave, using the same binaries, but other settings being different.



      The point of such a setup is to filter tables out of the replication process. Before replicating to a third external instance, controlled by a third party, I want to make sure that only certain tables show up in the binary logs. I have been using this method successfully for years.



      After upgrading to MySQL 5.7 my setup looks like this:



      [mysqld_multi]
      mysqld = /usr/bin/mysqld_safe
      mysqladmin = /usr/bin/mysqladmin
      user = multi_admin
      password = multipass

      [mysqld1]
      server-id = 1
      port = 3306
      user = mysql
      pid-file = /var/run/mysqld/mysqld.pid
      socket = /var/run/mysqld/mysqld.sock
      datadir = /var/lib/mysql
      log-error = /var/log/mysql/error.log
      ...

      [mysqld2]
      basedir = /usr
      server-id = 2
      port = 3307
      user = mysql
      pid-file = /var/run/mysqld/mysqld_blackhole_slave.pid
      socket = /var/run/mysqld/mysqld_blackhole_slave.sock
      datadir = /var/lib/mysql_blackhole_slave
      log-error = /var/log/mysql_blackhole_slave/error.log
      ...


      It is interesting to note that MySQL creates the /var/run/mysqld directory when the server is started, and deletes it when the server is shut down (and no other process is using it).



      In my /etc/init.d I have two related startup scripts: mysql and mysqld_multi.



      When the mysql script runs, it checks the my.cnf file, finds that there is no [mysqld] group, and therefore, starts a server instance with default settings. It creates the /var/run/mysqld directory, as mentioned above, and gets everything going. At this point I have a server instance running with default values that I did not specify.



      Then comes the mysqld_multi script. It looks for groups of [mysqldN] in my.cnf, and starts server instances accordingly. This will start two additional instances according to my specifications. At this point I have three server instances running instead of the two I requested in the configuration file.



      If I remove the mysql script from /etc/init.d, the default instance will not start, but neither will the other two because:




      mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't
      exists. (sic)




      Please note, it does not say it was unable to create the directory. It seems to assume the directory should exist at this point, but due to the removal of the mysql startup script, it never gets created. I believe this process does not attempt to create the directory. If it did attempt, one would assume a permission problem. I have disabled apparmor, and I have tried running these processes as root to rule out permission related issues.



      I can of course do:



      sudo mkdir /var/run/mysqld
      sudo chown mysql:mysql /var/run/mysqld


      and then start mysqld_multi. This works fine, but is a very unorthodox way of starting up your system.



      So I am wondering, is there not a proper way of starting mysqld_multi on this present system without hacking the process?







      share|improve this question














      The short version of the problem is that, upon boot, the default mysql startup script starts an unneeded general instance of the server with default settings, followed by mysqld_multi starting the required instances correctly, resulting in too many server instances.



      I'm on Ubuntu 14.04. Just upgraded the MySQL Server to version 5.7. I am aiming at running two instances of the MySQL server, one master and one slave, using the same binaries, but other settings being different.



      The point of such a setup is to filter tables out of the replication process. Before replicating to a third external instance, controlled by a third party, I want to make sure that only certain tables show up in the binary logs. I have been using this method successfully for years.



      After upgrading to MySQL 5.7 my setup looks like this:



      [mysqld_multi]
      mysqld = /usr/bin/mysqld_safe
      mysqladmin = /usr/bin/mysqladmin
      user = multi_admin
      password = multipass

      [mysqld1]
      server-id = 1
      port = 3306
      user = mysql
      pid-file = /var/run/mysqld/mysqld.pid
      socket = /var/run/mysqld/mysqld.sock
      datadir = /var/lib/mysql
      log-error = /var/log/mysql/error.log
      ...

      [mysqld2]
      basedir = /usr
      server-id = 2
      port = 3307
      user = mysql
      pid-file = /var/run/mysqld/mysqld_blackhole_slave.pid
      socket = /var/run/mysqld/mysqld_blackhole_slave.sock
      datadir = /var/lib/mysql_blackhole_slave
      log-error = /var/log/mysql_blackhole_slave/error.log
      ...


      It is interesting to note that MySQL creates the /var/run/mysqld directory when the server is started, and deletes it when the server is shut down (and no other process is using it).



      In my /etc/init.d I have two related startup scripts: mysql and mysqld_multi.



      When the mysql script runs, it checks the my.cnf file, finds that there is no [mysqld] group, and therefore, starts a server instance with default settings. It creates the /var/run/mysqld directory, as mentioned above, and gets everything going. At this point I have a server instance running with default values that I did not specify.



      Then comes the mysqld_multi script. It looks for groups of [mysqldN] in my.cnf, and starts server instances accordingly. This will start two additional instances according to my specifications. At this point I have three server instances running instead of the two I requested in the configuration file.



      If I remove the mysql script from /etc/init.d, the default instance will not start, but neither will the other two because:




      mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't
      exists. (sic)




      Please note, it does not say it was unable to create the directory. It seems to assume the directory should exist at this point, but due to the removal of the mysql startup script, it never gets created. I believe this process does not attempt to create the directory. If it did attempt, one would assume a permission problem. I have disabled apparmor, and I have tried running these processes as root to rule out permission related issues.



      I can of course do:



      sudo mkdir /var/run/mysqld
      sudo chown mysql:mysql /var/run/mysqld


      and then start mysqld_multi. This works fine, but is a very unorthodox way of starting up your system.



      So I am wondering, is there not a proper way of starting mysqld_multi on this present system without hacking the process?









      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 23 at 6:45

























      asked Apr 22 at 8:19









      Istvan Dupai

      114




      114

























          active

          oldest

          votes











          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',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          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%2f1027139%2fhow-to-prevent-default-mysql-instance-starting-when-mysqld-multi-is-used%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1027139%2fhow-to-prevent-default-mysql-instance-starting-when-mysqld-multi-is-used%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

          Trouble downloading packages list due to a “Hash sum mismatch” error

          How do I move numbers in filenames, in a batch renaming operation?