GET 24/7 LIVE HELP NOW

Announcement

Announcement Module
Collapse
No announcement yet.

CentOS 5 and Percona Startup (and my.cnf feedback request)

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • CentOS 5 and Percona Startup (and my.cnf feedback request)

    We've just received two new Cisco C210 servers and so I decided to install CentOS 5 - clean install.

    When I install MySQL 5.1 (or 5.5) and try to start it, it won't work unless I use the sudo command. Any idea why?

    [root@tigdb2 mysql]# /etc/init.d/mysql start
    Starting MySQL (Percona Server). ERROR! Manager of pid-file quit without updating file.
    [root@tigdb2 mysql]# sudo /bin/sh /etc/init.d/mysql start
    Starting MySQL (Percona Server).. SUCCESS!
    [root@tigdb2 mysql]#

    Also, I'd appreciate any feedback on this my.cnf - we have 64 GB of RAM:

    [mysqld]
    datadir = /var/lib/mysql

    port = 3306
    socket = /home/mysql/mysql.sock
    pid-file = /home/mysql/mysql.pid
    sync_binlog = 1
    skip-external-locking
    skip_name_resolve
    key_buffer = 400M
    max_allowed_packet = 8M
    table_cache = 2500
    sort_buffer_size = 3M
    read_buffer_size = 2M
    read_rnd_buffer_size = 6M
    myisam_sort_buffer_size = 50M
    thread_cache = 40
    query_cache_size = 512M
    ft_min_word_len = 3
    tmp_table_size = 512M
    max_heap_table_size = 128M
    query_cache_limit = 2M
    query_prealloc_size = 24576
    max_binlog_size = 128000000
    max_connect_errors = 10000
    wait_timeout = 1200
    expire_logs_days = 10

    slow-query-log = 1
    log-warnings = 0
    log-slave-updates
    long_query_time = 10
    #log-queries-not-using-indexes

    innodb_file_per_table
    myisam_recover=BACKUP,FORCE

    character-set-server=utf8
    thread_concurrency = 4
    max_connections = 500

    server_id = 5
    log-bin = tigdb3-bin
    relay-log = tigdb3-relay-bin
    auto_increment_increment = 2
    auto_increment_offset = 1
    slave-skip-errors=1062

    innodb_buffer_pool_size = 16384M
    innodb_additional_mem_pool_size = 20M
    innodb_flush_method=O_DIRECT
    innodb_log_file_size = 1024M
    innodb_log_buffer_size = 8M
    innodb_flush_log_at_trx_commit = 0

    [mysqldump]
    quick
    max_allowed_packet = 16M

  • #2
    Oops, I actually meant to reference CentOS 6, not 5. Any ideas on this issue?

    Comment


    • #3
      check the permissions of /home/mysql/mysql.pid and /home/mysql and make sure the mysql user can write to mysql.pid.

      Comment


      • #4
        Yes, both are owned by the mysql user/group. (and writable by both)

        Comment


        • #5
          Maybe there's more info in the MySQL log files, but please also check your system log files (selinux perhaps?)

          Comment


          • #6
            MySQL logs don't show anything

            I checked the two selinux options related to MySQL and have disabled both. Any specific selinux instructions for a setting change to allow MySQL to start? I'm not too familiar with SELinux.

            Thank you!

            Comment


            • #7
              I've noticed similar before on my servers.

              Your first start that 'failed', may not have actually failed. There is a timeout that might have happened first (wait a bit and then try and connect to MySQL / ps aux for it).

              Comment


              • #8
                Please, run "ausearch -c mysqld -sv no" and post output here

                Comment


                • #9
                  [root@tigdb1 ~]# ausearch -c mysqld -sv no

                  [root@tigdb1 ~]#

                  Comment


                  • #10
                    grep mysql /var/log/audit/audit.log
                    ?

                    Comment


                    • #11
                      Looks like that's where the issue is:

                      type=AVC msg=audit(1315120593.690:121821): avc: denied { read } for pid=30285 comm="mysqld_safe" name="mysql" dev=dm-0 ino=262357 scontext=unconfined_u:system_r:mysqld_safe_t:s0 tcontext=unconfined_ubject_r:var_lib_t:s0 tclass=lnk_file
                      type=SYSCALL msg=audit(1315120593.690:121821): arch=c000003e syscall=2 success=no exit=-13 a0=2021db0 a1=441 a2=1b6 a3=76 items=0 ppid=30271 pid=30285 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=5023 comm="mysqld_safe" exe="/bin/bash" subj=unconfined_u:system_r:mysqld_safe_t:s0 key=(null)
                      type=AVC msg=audit(1315120593.690:121822): avc: denied { read } for pid=30285 comm="mysqld_safe" name="mysql" dev=dm-0 ino=262357 scontext=unconfined_u:system_r:mysqld_safe_t:s0 tcontext=unconfined_ubject_r:var_lib_t:s0 tclass=lnk_file
                      type=SYSCALL msg=audit(1315120593.690:121822): arch=c000003e syscall=2 success=no exit=-13 a0=2021db0 a1=401 a2=1b6 a3=76 items=0 ppid=30271 pid=30285 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=5023 comm="mysqld_safe" exe="/bin/bash" subj=unconfined_u:system_r:mysqld_safe_t:s0 key=(null)

                      Guidance on fixing this much appreciated! This is a stock install of CentOS 6

                      Comment


                      • #12
                        The problem is that default SELinux rules are written for default locations. Eg datadir=/var/lib/mysql etc...
                        You must make a local security module to allow access to your custom locations or/and set TE context for new location.
                        And second. Remove symlink /var/lib/mysql -> /home/<......>. Instead specify real datadir location in my.cnf
                        run:

                        semanage fcontext -a -t mysqld_db_t "(/.*)?"; restorecon -R

                        replace with real path on your fs (without trailing slash).
                        But my sudgestion is to use inrule-predefined path for all parts of mysql. Or try to learn SELinux. It's not so hard

                        Comment


                        • #13
                          Thank you! Really appreciate the help. I changed the path in my.cnf to not use the symlink, and applied the changes you specified. Same issue though - I think something might still be missing?

                          [root@tigdb1 home]# semanage fcontext -a -t mysqld_db_t "/home/mysql(/.*)?";
                          [root@tigdb1 home]# restorecon -R /home/mysql
                          [root@tigdb1 home]# /etc/init.d/mysql stop
                          Shutting down MySQL.................. SUCCESS!
                          [root@tigdb1 home]# /etc/init.d/mysql start
                          Starting MySQL (Percona Server). ERROR! Manager of pid-file quit without updating file.

                          --

                          type=AVC msg=audit(1315257615.195:125379): avc: denied { read } for pid=4134 comm="mysqld_safe" name="mysql" dev=dm-0 ino=262357 scontext=unconfined_u:system_r:mysqld_safe_t:s0 tcontext=unconfined_ubject_r:var_lib_t:s0 tclass=lnk_file
                          type=SYSCALL msg=audit(1315257615.195:125379): arch=c000003e syscall=4 success=no exit=-13 a0=11b5a30 a1=7fff6605d420 a2=7fff6605d420 a3=8 items=0 ppid=4120 pid=4134 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=5291 comm="mysqld_safe" exe="/bin/bash" subj=unconfined_u:system_r:mysqld_safe_t:s0 key=(null)

                          Comment


                          • #14
                            I've been learning a bit and I've tried adding the rest of the file types, as found on:

                            http://docs.fedoraproject.org/en-US/Fedora/13/html/Managing_ Confined_Services/sect-Managing_Confined_Services-MySQL-Type s.html

                            /home/mysql(/.*)? system_ubject_r:mysqld_db_t:s0
                            /etc/my.cnf system_ubject_r:mysqld_etc_t:s0
                            /etc/rc.d/init.d/mysql system_ubject_r:mysqld_initrc_exec_t:s0
                            /var/run/mysqld/mysql.pid system_ubject_r:mysqld_var_run_t:s0
                            /var/run/mysqld/mysql.sock system_ubject_r:mysqld_var_run_t:s0

                            So far it still won't start...

                            mysqld_safe is also specified with mysqld_safe_exec_t

                            Comment


                            • #15
                              OK. Before mysqld launch view `date` and after launch do ausearch -ts -sv no
                              Post output here

                              Comment

                              Working...
                              X