ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    MySQL configuration best practices

    Scheduled Pinned Locked Moved IT Discussion
    mysqlbest practicesmariadbdatabasesrdbms
    12 Posts 5 Posters 2.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • QuixoticJustinQ
      QuixoticJustin
      last edited by

      Best practice is also to either manually configure security or more commonly to run the included secure script to lock things down.

      Emad RE 2 Replies Last reply Reply Quote 1
      • dbeatoD
        dbeato
        last edited by

        Have you ever used Percona?

        AdamFA 1 Reply Last reply Reply Quote 0
        • Emad RE
          Emad R @AdamF
          last edited by

          @fuznutz04

          if you are replicating 2 MySQL instances you need
          expire_logs_days=X
          to be enabled, however having a high value will truly eat alot of space.

          AdamFA 1 Reply Last reply Reply Quote 0
          • AdamFA
            AdamF @dbeato
            last edited by

            @dbeato said in MySQL configuration best practices:

            Have you ever used Percona?

            No, never. What is it?

            dbeatoD 1 Reply Last reply Reply Quote 0
            • AdamFA
              AdamF @Emad R
              last edited by

              @emad-r said in MySQL configuration best practices:

              @fuznutz04

              if you are replicating 2 MySQL instances you need
              expire_logs_days=X
              to be enabled, however having a high value will truly eat alot of space.

              Very true.

              1 Reply Last reply Reply Quote 0
              • dbeatoD
                dbeato @AdamF
                last edited by

                @fuznutz04 Percona is use for HA of MYSQL and replication.

                1 Reply Last reply Reply Quote 1
                • jmooreJ
                  jmoore
                  last edited by

                  I use the lockdown script and mysql tuner. I am sure there are many other things I need to do but have not had time to investigate yet. I use mariadb.

                  1 Reply Last reply Reply Quote 0
                  • Emad RE
                    Emad R @QuixoticJustin
                    last edited by

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • Emad RE
                      Emad R @QuixoticJustin
                      last edited by

                      @quixoticjustin

                      But that only covers the security aspect, what we are talking about is performance tweaks this:

                      [mysqld]
                      datadir=/var/lib/mysql
                      socket=/var/lib/mysql/mysql.sock
                      symbolic-links=0	# Disabling symbolic-links is recommended to prevent assorted security risks
                      default-storage-engine=innodb
                      character-set-server=utf8
                      collation-server=utf8_general_ci
                      
                      # CACHES AND LIMITS #
                      tmp-table-size=32M
                      max-heap-table-size=32M
                      query-cache-type=0
                      query-cache-size=0
                      max-connections=500
                      thread-cache-size=50
                      open-files-limit=65535
                      table-definition-cache=1024
                      table-open-cache=2048
                      thread_concurrency=4  	#recommend 2x CPU cores [0 create as many as needed]
                      thread_cache_size=100	#recommend 5% of max_connections
                      
                      # INNODB #
                      innodb-buffer-pool-size=2G	#recommend 50% of RAM
                      innodb-flush-log-at-trx-commit=1
                      innodb-file-per-table=1
                      innodb_write_io_threads=2	#recommend 50% of CPU
                      innodb_read_io_threads=2	#recommend 50% of CPU
                      innodb_log_buffer_size=256M 	#global buffer
                      innodb_lock_wait_timeout=300	
                      
                      [mysqld_safe]
                      log-error=/var/log/mariadb/mariadb.log
                      pid-file=/var/run/mariadb/mariadb.pid
                      
                      #
                      # include all files from the config directory
                      #
                      !includedir /etc/my.cnf.d
                      

                      That said if you dont know what you are doing, it is best to leave it default in a database world.

                      AdamFA 1 Reply Last reply Reply Quote 0
                      • AdamFA
                        AdamF @Emad R
                        last edited by

                        @emad-r

                        What is your practice for log rotation? For example, the error log. If that grows (obviously indicating other issues) , and needs to be rotated, what procedure do you use to rotate logs?

                        Emad RE 1 Reply Last reply Reply Quote 0
                        • Emad RE
                          Emad R @AdamF
                          last edited by

                          @fuznutz04 said in MySQL configuration best practices:

                          @emad-r

                          What is your practice for log rotation? For example, the error log. If that grows (obviously indicating other issues) , and needs to be rotated, what procedure do you use to rotate logs?

                          Currently the third party vendor uses this:

                          expire_logs_days = 10
                          max_binlog_size = 100M

                          In our MySQL instance.

                          1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          • First post
                            Last post