Created
May 12, 2023 06:58
Revisions
-
Akkiesoft revised this gist
May 12, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -102,5 +102,5 @@ $ docker-compose down;docker-compose up -d * 確認が済んだら、notes indexは消してOK ``` $ docker-compose exec meilisearch curl -X DELETE http://localhost:7700/indexes/notes -H "Authorization: Bearer $MEILI_ADMIN_API_KEY" ``` -
Akkiesoft created this gist
May 12, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,106 @@ # Misskey 13.12.2のMeilisearch indexリネーム手順 ## 概要 https://misskey-hub.net/docs/releases.html#_13-12-2 > Meilisearchの設定に```index```が必要になりました。値はMisskeyサーバーのホスト名にすることをお勧めします(アルファベット、ハイフン、アンダーバーのみ使用可能)。例: ```misskey-io``` 過去に作成された```notes```インデックスは、```<index名>---notes```にリネームが必要です。例: ```misskey-io---notes``` ## 前提 * docker-composeで運用してる環境で実施 * そうじゃなくても```docker-compose exec meilisearch ```を取っ払えば多分同じ ## 手順 * API keyの取得 ``` $ source .config/meilisearch.env $ docker-compose exec meilisearch curl -X GET http://localhost:7700/keys -H "Authorization: Bearer $MEILI_MASTER_KEY" ``` * Default Admin API Keyのkeyを仮のenvファイルに格納して使うようにする ``` $ vi .config/meili-api.env export MEILI_ADMIN_API_KEY=<キー> $ source .config/meili-api.env ``` * indexの取得。いまはnotesのみ。 ``` $ docker-compose exec meilisearch curl -X GET http://localhost:7700/indexes -H "Authorization: Bearer $MEILI_ADMIN_API_KEY" {"results":[{"uid":"notes","createdAt":"2023-05-10T14:45:45.25817599Z","updatedAt":"2023-05-12T06:28:53.176409423Z","primaryKey":"id"}],"offset":0,"limit":20,"total":1} ``` * あたらしいindexの作成。インデックス名のうしろに「---notes」を付け足したものを作成。 ``` $ docker-compose exec meilisearch curl -X POST http://localhost:7700/indexes -H "Authorization: Bearer $MEILI_ADMIN_API_KEY" -H 'Content-Type: application/json' \ --data-binary '{ "uid": "mugiko-moe---notes", "primaryKey": "id" }' ``` * 作成後のindexのリスト。2つになっている ``` $ docker-compose exec meilisearch curl -X GET http://localhost:7700/indexes -H "Authorization: Bearer $MEILI_ADMIN_API_KEY" {"results":[{"uid":"mugiko-moe---notes","createdAt":"2023-05-10T14:45:45.25817599Z","updatedAt":"2023-05-12T06:50:11.598657956Z","primaryKey":"id"},{"uid":"notes","createdAt":"2023-05-12T06:35:26.419725388Z","updatedAt":"2023-05-12T06:35:26.430011167Z","primaryKey":"id"}],"offset":0,"limit":20,"total":2} ``` * ここでコンテナを停止して、バージョンアップの処理(ビルド)をやっておく。その間もMeilisearchはいじるので、Meilisearchだけ起動する ``` $ docker-compose down $ docker-compose up meilisearch -d (別画面を出しといてバージョン追従とかbuildを実行しておく) ``` * indexを入れ替える ``` $ docker-compose exec meilisearch curl -X POST http://localhost:7700/swap-indexes -H "Authorization: Bearer $MEILI_ADMIN_API_KEY" -H 'Content-Type: application/json' \ --data-binary '[ { "indexes": [ "notes", "mugiko-moe---notes" ] } ]' 結果はこんなかんじ {"taskUid":2552,"indexUid":null,"status":"enqueued","type":"indexSwap","enqueuedAt":"2023-05-12T06:38:46.918304584Z"} ``` * 新しい設定の投入 ``` $ vi .config/default.yml meilisearch: host: meilisearch port: 7700 apiKey: '<KEY>' ssl: false index: 'mugiko-moe' ←ココ! ``` * コンテナの再起動 ``` $ docker-compose down;docker-compose up -d ``` * 作業前のデータ検索ができることを確認する * 確認が済んだら、notes indexは消してOK ``` docker-compose exec meilisearch curl -X DELETE http://localhost:7700/indexes/notes -H "Authorization: Bearer $MEILI_ADMIN_API_KEY" ```