echo "=================将mysql加入到系统服务================"
chmod 777 -R /usr/local/mysql
chmod 777 -R /data/mysql_6606
echo "=================将mysql配置文件复到到系统配置文件里去================"
cp /usr/local/mysql/mysql6606.cnf /etc/my.cnf
echo "=================将mysql服务加到开机自启动项里去================"
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
#mysql
vim /etc/profile
export MYSQL_HOME=/usr/local/mysql
export PATH=${MYSQL_HOME}/bin:$PATH
#退出保存,且重新加载配置文件
source /etc/profile
#kill掉MySQL的进程,先杀守护进程,再杀mysql主进程
。。。。。。(根据ps去查询进程号来kill)
#重启MySQL,只需要重启守护线程
/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &
echo "=================开始分配cup================"
taskset -cp 71 `pidof mysqld`
;;
echo "=================开始分配内存================"
systemctl set-property mysqld.service MemoryLimit=5G
#查看设置是否成功?
systemctl status mysqld.service
#安装sysbench
curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash
sudo yum -y install sysbench
===============================资源限制===============================
查看slice树
systemd-cgls
systemctl set-property session-25497.scope MemoryLimit=57G
systemctl set-property session-25497.scope CPUQuota=800%
根据会话级限制CPU和内存。