1,yum install -y lrzsz.x86_64 cmake gcc gcc-c++ ncurses-devel readline-devel zlib-devel curl-devel libtirpc-devel bison
如果在centos8.x上安装,可能还会出现:Could not find rpcgen 报错,rpcgen作用如下:
percona 5.7 最新下载地址:https://www.percona.com/downloads/Percona-Server-5.7/LATEST/
which is needed to create header files and sources from protocol files. This package is only needed, if glibc is installed without the deprecated sunrpc functionality and libtirpc should replace it
通过到下面链接:https://github.com/thkukuk/rpcsvc-proto/releases 下载 rpcsvc-proto
然后解压缩,configur;make ;make install 即可
2,cmake . -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/root -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/webdata/opt/local/percona -DWITH_SYSTEMD=1
3,./bin/mysqld --initialize --datadir=/webdata/opt/local/percona/data/ --user=mysql
./mysqld --initialize --user=mysql --basedir=/webdata/opt/local/percona --datadir=/webdata/opt/local/percona/data
4,useradd mysql -s /sbin/nologin -M
5,
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# systemd service file for MySQL forking server
#
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
Alias=mysql.service
[Service]
User=mysql
Group=mysql
Type=forking
PIDFile=/webdata/opt/local/percona/misc/mysql.pid
# Disable service start and stop timeout logic of systemd for mysqld service.
TimeoutSec=0
# Execute pre and post scripts as root
PermissionsStartOnly=true
# Needed to create system tables
ExecStartPre=/webdata/opt/local/percona/bin/mysqld_pre_systemd
# Start main service
ExecStart=/webdata/opt/local/percona/bin/mysqld --daemonize --pid-file=/webdata/opt/local/percona/misc/mysql.pid $MYSQLD_OPTS
# Use this to switch malloc implementation
EnvironmentFile=-/etc/sysconfig/mysql
# Sets open_files_limit
LimitCORE=infinity
LimitNOFILE=51200
LimitNPROC=51200
Restart=on-failure
RestartPreventExitStatus=1
PrivateTmp=false
6,alter user root@'localhost' identified by 'waglo'
使用jemalloc作为mysql的内存分配
使用jemalloc: wget https://github.com/jemalloc/jemalloc/releases/download/4.4.0/jemalloc-4.4.0.tar.bz2 yum install bzip2 tar xjf jemalloc-4.4.0.tar.bz2 cd jemalloc-4.4.0 ./configure make && make install cat /usr/lib/systemd/system/mysqld.service 文件中指定了环境变量值如下: # Use this to switch malloc implementation EnvironmentFile=-/etc/sysconfig/mysql vi /etc/sysconfig/mysql LD_PRELOAD=/usr/local/lib/libjemalloc.so systemctl restart mysqld 验证jemalloc优化是否生效: yum install lsof lsof -n | grep jemalloc
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!