「Percona Server」:修訂間差異
跳至導覽
跳至搜尋
(未顯示同一使用者於中間所作的 19 次修訂) | |||
第1行: | 第1行: | ||
'''Percona Server'''是一套資料庫軟體,源自[[MySQL]]。 | '''Percona Server'''是一套由[[Percona]]維護的資料庫軟體,源自[[MySQL]]。 | ||
== 安裝 == | == 安裝 == | ||
第5行: | 第5行: | ||
[[MySQL]]系的資料庫在使用[[jemalloc]]時效能都會提昇不少,所以在不少衍生版本都有支援jemalloc。其中Percona Server在偵測到系統內有jemalloc時會自動啟用<ref>{{Cite web |url=https://www.percona.com/blog/2017/01/03/enabling-and-disabling-jemalloc-on-percona-server/ |title=Enabling and Disabling Jemalloc on Percona Server |accessdate=2018-04-23 |date=2017-01-03}}</ref>,減少了設定所需的手續。 | [[MySQL]]系的資料庫在使用[[jemalloc]]時效能都會提昇不少,所以在不少衍生版本都有支援jemalloc。其中Percona Server在偵測到系統內有jemalloc時會自動啟用<ref>{{Cite web |url=https://www.percona.com/blog/2017/01/03/enabling-and-disabling-jemalloc-on-percona-server/ |title=Enabling and Disabling Jemalloc on Percona Server |accessdate=2018-04-23 |date=2017-01-03}}</ref>,減少了設定所需的手續。 | ||
在[[Ubuntu]]上 | 在[[Ubuntu]]上先安裝<code>gnupg2</code>,等下會用到: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo apt install -y gnupg2 | sudo apt install -y gnupg2; sudo apt clean | ||
</syntaxhighlight> | </syntaxhighlight> | ||
第17行: | 第17行: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
裝完後可以更新系統並且安裝Percona Server 5.7: | 裝完後可以更新系統並且安裝Percona Server 5.7與<code>libjemalloc1</code>: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo apt update; sudo apt install -y percona-server-server-5.7 | sudo apt update; sudo apt install -y libjemalloc1 percona-server-server-5.7; sudo apt clean | ||
</syntaxhighlight> | </syntaxhighlight> | ||
第26行: | 第26行: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo percona-release setup ps80; sudo apt install -y percona-server-server | sudo percona-release setup ps80; sudo apt install -y libjemalloc2 percona-server-server; sudo apt clean | ||
</syntaxhighlight> | |||
另外可以加裝mycli: | |||
<syntaxhighlight lang="bash"> | |||
sudo apt install -y mycli; sudo apt clean | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== 設定 == | == 設定 == | ||
先停掉telemetry: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo | sudo systemctl disable --now percona-telemetry-agent | ||
</syntaxhighlight> | </syntaxhighlight> | ||
在第一次設定前先停掉Percona Server: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo | sudo service mysql stop | ||
</syntaxhighlight> | </syntaxhighlight> | ||
第49行: | 第55行: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Percona Server 8.0版本的則是: | Percona Server 8.0版本的則是,可以參考[https://github.com/gslin/mysql-template/blob/master/mysql-8.0.cnf mysql-8.0.cnf]這邊的設定檔: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
第72行: | 第78行: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo apt install -y gnupg2 | sudo apt install -y gnupg2; cd /tmp; wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb; sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb; sudo apt update; sudo apt install -y libjemalloc1 mycli percona-server-server-5.7; sudo apt clean; sudo systemctl disable --now percona-telemetry-agent; sudo service mysql stop; cd /etc/mysql/percona-server.conf.d/; sudo mv mysqld.cnf mysqld.cnf.bak; sudo wget -O mysqld.cnf https://raw.githubusercontent.com/gslin/mysql-template/master/mysql-5.7.cnf; sudo mkdir /srv/tmp; sudo chmod 1777 /srv/tmp; sudo service mysql start | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Percona Server 8.0的則是: | Percona Server 8.0版本的則是: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo apt install -y gnupg2 | sudo apt install -y gnupg2; cd /tmp; wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb; sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb; sudo percona-release setup ps80; sudo apt install -y libjemalloc2 mycli percona-server-server; sudo apt clean; sudo systemctl disable --now percona-telemetry-agent; sudo service mysql stop; cd /etc/mysql/mysql.conf.d/; sudo mv mysqld.cnf mysqld.cnf.bak; sudo wget -O mysqld.cnf https://raw.githubusercontent.com/gslin/mysql-template/master/mysql-8.0.cnf; sudo mkdir /srv/tmp; sudo chmod 1777 /srv/tmp; sudo service mysql start | ||
</syntaxhighlight> | </syntaxhighlight> | ||
於 2024年8月6日 (二) 14:40 的最新修訂
Percona Server是一套由Percona維護的資料庫軟體,源自MySQL。
安裝
MySQL系的資料庫在使用jemalloc時效能都會提昇不少,所以在不少衍生版本都有支援jemalloc。其中Percona Server在偵測到系統內有jemalloc時會自動啟用[1],減少了設定所需的手續。
在Ubuntu上先安裝gnupg2
,等下會用到:
sudo apt install -y gnupg2; sudo apt clean
首先安裝Percona的APT設定,以及對應所需的Key:
cd /tmp; wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb; sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
裝完後可以更新系統並且安裝Percona Server 5.7與libjemalloc1
:
sudo apt update; sudo apt install -y libjemalloc1 percona-server-server-5.7; sudo apt clean
或是Percona Server 8.0:
sudo percona-release setup ps80; sudo apt install -y libjemalloc2 percona-server-server; sudo apt clean
另外可以加裝mycli:
sudo apt install -y mycli; sudo apt clean
設定
先停掉telemetry:
sudo systemctl disable --now percona-telemetry-agent
在第一次設定前先停掉Percona Server:
sudo service mysql stop
接著到/etc/mysql/percona-server.conf.d/
下將本來的設定檔改名,然後可以參考mysql-5.7.cnf這邊的設定檔:
cd /etc/mysql/percona-server.conf.d/; sudo mv mysqld.cnf mysqld.cnf.bak; sudo wget -O mysqld.cnf https://raw.githubusercontent.com/gslin/mysql-template/master/mysql-5.7.cnf; sudo mkdir /srv/tmp; sudo chmod 1777 /srv/tmp
Percona Server 8.0版本的則是,可以參考mysql-8.0.cnf這邊的設定檔:
cd /etc/mysql/mysql.conf.d/; sudo mv mysqld.cnf mysqld.cnf.bak; sudo wget -O mysqld.cnf https://raw.githubusercontent.com/gslin/mysql-template/master/mysql-8.0.cnf; sudo mkdir /srv/tmp; sudo chmod 1777 /srv/tmp
其中最主要的值是innodb_buffer_pool_size
,表示InnoDB在記憶體內佔用的空間(這邊設定值不包括overhead,所以實際使用的量通常會超過所設定的值)。當整台機器都是專門給Percona Server使用時,會設定整台伺服器記憶體的60%到75%。如果不是專門使用時可以看資料量與特性決定:
innodb_buffer_pool_size = 64M
設完後就可以啟動:
sudo service mysql start
快速安裝
把上面提到的指令一次跑完:
sudo apt install -y gnupg2; cd /tmp; wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb; sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb; sudo apt update; sudo apt install -y libjemalloc1 mycli percona-server-server-5.7; sudo apt clean; sudo systemctl disable --now percona-telemetry-agent; sudo service mysql stop; cd /etc/mysql/percona-server.conf.d/; sudo mv mysqld.cnf mysqld.cnf.bak; sudo wget -O mysqld.cnf https://raw.githubusercontent.com/gslin/mysql-template/master/mysql-5.7.cnf; sudo mkdir /srv/tmp; sudo chmod 1777 /srv/tmp; sudo service mysql start
Percona Server 8.0版本的則是:
sudo apt install -y gnupg2; cd /tmp; wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb; sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb; sudo percona-release setup ps80; sudo apt install -y libjemalloc2 mycli percona-server-server; sudo apt clean; sudo systemctl disable --now percona-telemetry-agent; sudo service mysql stop; cd /etc/mysql/mysql.conf.d/; sudo mv mysqld.cnf mysqld.cnf.bak; sudo wget -O mysqld.cnf https://raw.githubusercontent.com/gslin/mysql-template/master/mysql-8.0.cnf; sudo mkdir /srv/tmp; sudo chmod 1777 /srv/tmp; sudo service mysql start
相關連結
參考資料
- ↑ Enabling and Disabling Jemalloc on Percona Server. 2017-01-03 [2018-04-23].
外部連結
- 官方網站 (英文)