mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 05:14:10 -07:00
optimized mysql config for virtual servers
This commit is contained in:
parent
41ec45e840
commit
d76e9f03fa
2 changed files with 38 additions and 1 deletions
32
install/0.9.7/rhel/mysql-512.cnf
Normal file
32
install/0.9.7/rhel/mysql-512.cnf
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
[mysqld]
|
||||||
|
datadir=/var/lib/mysql
|
||||||
|
socket=/var/lib/mysql/mysql.sock
|
||||||
|
user=mysql
|
||||||
|
symbolic-links=0
|
||||||
|
max_connections=70
|
||||||
|
max_user_connections=30
|
||||||
|
wait_timeout=10
|
||||||
|
interactive_timeout=50
|
||||||
|
long_query_time=5
|
||||||
|
#log-queries-not-using-indexes
|
||||||
|
#log-slow-queries=/var/log/mysql/log-slow-queries.log
|
||||||
|
|
||||||
|
key_buffer = 16M
|
||||||
|
myisam_sort_buffer_size = 32M
|
||||||
|
join_buffer_size=1M
|
||||||
|
read_buffer_size=1M
|
||||||
|
sort_buffer_size=2M
|
||||||
|
table_cache=1024
|
||||||
|
thread_cache_size=286
|
||||||
|
interactive_timeout=25
|
||||||
|
connect_timeout=5
|
||||||
|
max_allowed_packet=1M
|
||||||
|
max_connect_errors=1000
|
||||||
|
query_cache_limit=1M
|
||||||
|
query_cache_size=8M
|
||||||
|
query_cache_type=1
|
||||||
|
tmp_table_size=16M
|
||||||
|
|
||||||
|
[mysqld_safe]
|
||||||
|
log-error=/var/log/mysqld.log
|
||||||
|
pid-file=/var/run/mysqld/mysqld.pid
|
|
@ -436,7 +436,12 @@ if [ -e '/root/.my.cnf' ]; then
|
||||||
mv /root/.my.cnf $vst_backups/mysql/
|
mv /root/.my.cnf $vst_backups/mysql/
|
||||||
fi
|
fi
|
||||||
mpass=$(gen_pass)
|
mpass=$(gen_pass)
|
||||||
|
server_memory="$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])"
|
||||||
|
if [ "$server_memory" -gt '1000000' ]; then
|
||||||
wget $CHOST/$VERSION/mysql.cnf -O /etc/my.cnf
|
wget $CHOST/$VERSION/mysql.cnf -O /etc/my.cnf
|
||||||
|
else
|
||||||
|
wget $CHOST/$VERSION/mysql-512.cnf -O /etc/my.cnf
|
||||||
|
fi
|
||||||
service mysqld start
|
service mysqld start
|
||||||
mysqladmin -u root password $mpass
|
mysqladmin -u root password $mpass
|
||||||
echo -e "[client]\npassword='$mpass'\n" >/root/.my.cnf
|
echo -e "[client]\npassword='$mpass'\n" >/root/.my.cnf
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue