Slackのかわりに Mattermostを利用しているのだが,Default 環境では日本語検索ができない.日本語全文検索可能なストレージエンジン Mroonga を導入して検索できるようにする.環境は Debian GNU/Linux の stable (buster; Debian 10),RDBMS (relational database management system) は MySQL派生の MariaDB (Debian 9 以降の Default RDBMS).
以下で Mroonga を install
sudo aptitude install mariadb-plugin-mroonga
MySQL (=MariaDB,以下同様)が既に導入済みで password 設定済みだと
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
のように MySQL への install に失敗するので以下実行.
mysql -u root -p<sql root password> < /usr/share/mysql/mroonga/install.sql
登録済みエンジン確認.
% mysql -u root -p<sql root password>
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 49565
Server version: 10.3.22-MariaDB-0+deb10u1 Debian 10
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show engines;
+--------------------+---------+----------------------------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------------------------+--------------+------+------------+
| MRG_MyISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | Stores tables as CSV files | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| MyISAM | YES | Non-transactional engine with good performance and small data footprint | NO | NO | NO |
| Aria | YES | Crash-safe tables with MyISAM heritage | NO | NO | NO |
| Mroonga | YES | CJK-ready fulltext search, column store | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, foreign keys and encryption for tables | YES | YES | YES |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| SEQUENCE | YES | Generated tables filled with sequential values | YES | NO | YES |
+--------------------+---------+----------------------------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.000 sec)
テーブルのエンジン確認.Mattermost の DB name は mattermost
を想定.
MariaDB [(none)]> select table_name, engine from information_schema.tables where table_schema = 'mattermost';
+----------------------+--------+
| table_name | engine |
+----------------------+--------+
| ClusterDiscovery | InnoDB |
| Compliances | InnoDB |
| Systems | InnoDB |
| Licenses | InnoDB |
| Tokens | InnoDB |
| ChannelMemberHistory | InnoDB |
| PluginKeyValueStore | InnoDB |
| TermsOfService | InnoDB |
| Reactions | InnoDB |
| Roles | InnoDB |
| Schemes | InnoDB |
| Teams | InnoDB |
| TeamMembers | InnoDB |
| ChannelMembers | InnoDB |
| Channels | InnoDB |
| PublicChannels | InnoDB |
| Posts | InnoDB |
| Users | InnoDB |
| Audits | InnoDB |
| Sessions | InnoDB |
| OAuthApps | InnoDB |
| OAuthAccessData | InnoDB |
| OAuthAuthData | InnoDB |
| IncomingWebhooks | InnoDB |
| OutgoingWebhooks | InnoDB |
| Commands | InnoDB |
| CommandWebhooks | InnoDB |
| Preferences | InnoDB |
| Emoji | InnoDB |
| Status | InnoDB |
| FileInfo | InnoDB |
| Jobs | InnoDB |
| UserAccessTokens | InnoDB |
| UserTermsOfService | InnoDB |
| LinkMetadata | InnoDB |
| GroupMembers | InnoDB |
| UserGroups | InnoDB |
| Bots | InnoDB |
| GroupTeams | InnoDB |
| GroupChannels | InnoDB |
+----------------------+--------+
Channels と Posts のエンジンを Mroonga に変更.その後上のコマンドでテーブルのエンジン確認.
MariaDB [mattermost]> alter table Channels ENGINE = Mroonga;
MariaDB [mattermost]> alter table Posts ENGINE = Mroonga;
念の為 Mattermost 再起動(systemctl で制御可能であることを想定).
ちなみに Mattermost,既存 Web server を利用することができるが,パスとして / から利用するので,それ用のドメインを切って Virtual Domain にて運用.
% sudo systemctl stop mattermost.service
% sudo systemctl start mattermost.service
参考にしたページ: