37 | | Whatever you choose, it always starts with one and grows with the |
38 | | number of concurrent requests up to the value of pools (the max number |
39 | | of concurrent pools). So pools should be the max number of concurrent |
40 | | requests you expect. That is the max value of: |
41 | | <number of requests/second> / <average time per request in seconcds> |
| 37 | Whatever you choose, it always starts with one and grows with the number of concurrent requests up to the value of pools (the max number of concurrent pools). So pools should be the max number of concurrent requests you expect. That is the max value of: |
| 38 | {{{ |
| 39 | <number of requests/second> / <average time per request in seconds> |
| 40 | }}} |
| 41 | |
| 42 | === MySQL optimisation === |
| 43 | For Production instances, give the MySQL database plenty of RAM: |
| 44 | {{{ |
| 45 | innodb_buffer_pool_size = 2048M |
| 46 | innodb_file_per_table |
| 47 | innodb_thread_concurrency = 8 |
| 48 | }}} |
| 49 | |
| 50 | === MySQL Replication === |
| 51 | In order to have a backup instance, configure replication from the Master node to a Backup node: |
| 52 | * http://www.debiantutorials.net/mysql-database-replication-masterslave/ |
| 53 | On Master: |
| 54 | {{{ |
| 55 | pico /etc/mysql/my.cnf |
| 56 | #bind-address = 127.0.0.1 |
| 57 | server-id = 1 |
| 58 | log_bin = /var/log/mysql/mysql-bin.log |
| 59 | binlog_do_db = sahana |
| 60 | |
| 61 | /etc/init.d/mysql restart |
| 62 | |
| 63 | mysql -u root -p |
| 64 | GRANT REPLICATION SLAVE ON sahana.* to username@'sl.av.e.ip' IDENTIFIED BY 'mypassword'; |
| 65 | FLUSH PRIVILEGES; |
| 66 | SHOW MASTER STATUS; |
| 67 | }}} |
| 68 | Read log filename & position for configuring the slave (see below). |
| 69 | |
| 70 | On Slave: |
| 71 | {{{ |
| 72 | pico /etc/mysql/my.cnf |
| 73 | server-id = 2 |
| 74 | master-host = ma.st.er.ip |
| 75 | master-user = username |
| 76 | master-password = mypassword |
| 77 | master-connect-retry = 60 |
| 78 | replicate-do-db = sahana |
| 79 | |
| 80 | /etc/init.d/mysql restart |
| 81 | |
| 82 | mysql -u root -p) |
| 83 | |
| 84 | SLAVE STOP; |
| 85 | CHANGE MASTER TO MASTER_HOST='ma.st.er.ip', MASTER_USER='username', MASTER_PASSWORD='mypassword', MASTER_LOG_FILE='log_file', MASTER_LOG_POS=log_position; |
| 86 | SLAVE START; |
| 87 | }}} |
| 88 | |
| 89 | ==== IP Failover ==== |
| 90 | Can configure the slave to adopt the same IP as the master using a Heartbeat. |
| 91 | |
| 92 | If using Slicehost: |
| 93 | * http://articles.slicehost.com/2008/10/28/ip-failover-slice-setup-and-installing-heartbeat |