seafile-admin-docs/manual/extension/distributed_indexing.md
Huang Junxiang ffbd9d329b
Merge 12.0 to 13.0 (#526)
* Add changelog for 12.0.10

* Add changelog for 12.0.10

* fix: migrate from non-docker

* fix: minimal install for mariadb in backup and recover

* fix: fuse content missing in host

* opt:adjusting migration strategy

* Add changelog for pro 12.0.10

* Update security_features.md

Update descriptions for encrypted library.

* Update seahub_settings_py.md

Update description for encrypted library versions.

* docs: update Windows development setup instructions for vcpkg (#471)

* Update drive-client-changelog.md

3.0.13

* update seasearch.yml

* update

* Update shibboleth_authentication.md

* Update remote_user.md

* fix: backup & restore command mysql -> mariadb

* update backup and recovery commands and tip

* opt: steps in recovering DB

* update link of note of MDEV-30203 note from Mariadb

* update link of note of MDEV-30203 note from Mariadb

* opt: steps in recovering DB

* Add changelog for 12.0.11-pro

* Add changelog for v12.0.11

* fix: ce binary deployment format error

* Update changelog-for-seafile-professional-server.md

* feat: helm support custom storageClassName (#486)

* docs(onlyoffice): syntax error (#489)

* Custom set user role when shib login (#493)

Co-authored-by: lian <imwhatiam123@gmail.com>

* Seahub customizing opt (#499)

* update

* Update seahub_customization.md

* Update client-changelog.md

9.0.13

* Update upgrade_notes_for_12.0.x.md (#501)

* Update upgrade_notes_for_12.0.x.md

* Update upgrade_notes_for_12.0.x.md

---------

Co-authored-by: Daniel Pan <freeplant@gmail.com>

* Update upgrade_docker.md

* update upgrade to 12.0: other configuration changes (#502)

* Update changelog-for-seafile-professional-server.md

* perf: Priority issues for S3_HOST and S3_AWS_REGION in 12.0

* perf: Priority issues for S3_HOST and S3_AWS_REGION in 12.0

* Update sending_email.md (#512)

* Update sending_email.md

* Update sending_email.md

* Update drive-client-changelog.md

3.0.14

* Update drive-client-changelog.md

3.0.14

* code bar copy button (#517)

* Update changelog-for-seafile-professional-server.md

* 12.0 index master (#518)

* add index-server

* deploy index-server

* deploy index-server

* rm redis in env

* Update distributed_indexing.md

* update restore-all-repo command

---------

Co-authored-by: Daniel Pan <freeplant@gmail.com>

* wget index-server.yml

* update index-server conf

* update index-worker.conf

* SeaDoc standalone Apache proxy (#519)

* fix: typo error serve -> server (#522)

* update 12.0 seasearch default image (#523)

* fix: use nginx to proxy onlyoffice (#525)

---------

Co-authored-by: Daniel Pan <daniel.pan@seafile.com>
Co-authored-by: Daniel Pan <freeplant@gmail.com>
Co-authored-by: Jiaqiang Xu <jonathan.xu@seafile.com>
Co-authored-by: rumtid <liwei.jiang@seafile.com>
Co-authored-by: r350178982 <32759763+r350178982@users.noreply.github.com>
Co-authored-by: lian <imwhatiam123@gmail.com>
Co-authored-by: seafile-dev <57566977+seafile-dev@users.noreply.github.com>
Co-authored-by: 欢乐马 <38058090+SkywalkerSpace@users.noreply.github.com>
Co-authored-by: skywalker <dzmbbs@qq.com>
2025-05-27 14:30:04 +08:00

4.0 KiB

Distributed indexing

If you use a cluster to deploy Seafile, you can use distributed indexing to realize real-time indexing and improve indexing efficiency. The indexing process is as follows:

Install redis and modify configuration files

1. Install redis on all frontend nodes

!!! tip If you use redis cloud service, skip this step and modify the configuration files directly

=== "Ubuntu" $ apt install redis-server === "CentOS" $ yum install redis

2. Install python redis third-party package on all frontend nodes

$ pip install redis

3. Modify the seafevents.conf on all frontend nodes

Add the following config items

[EVENTS PUBLISH]
mq_type=redis   # must be redis
enabled=true

[REDIS]
server=127.0.0.1   # your redis server host
port=6379          # your redis server port
password=xxx       # your redis server password, if not password, do not set this item

4. Modify the seafevents.conf on the backend node

Disable the scheduled indexing task, because the scheduled indexing task and the distributed indexing task conflict.

[INDEX FILES]
enabled=true
     |
     V
enabled=false   

5. Restart Seafile

=== "Deploy in Docker" sh docker exec -it seafile bash cd /scripts ./seafile.sh restart && ./seahub.sh restart === "Deploy from binary packages" sh cd /opt/seafile/seafile-server-latest ./seafile.sh restart && ./seahub.sh restart

Deploy distributed indexing

First, prepare a index-server master node and several index-server slave nodes, the number of slave nodes depends on your needs. Copy the seafile.conf and the seafevents.conf in the conf directory from the Seafile frontend nodes to /opt/seafile-data/seafile/conf in index-server nodes. The master node and slave nodes need to read the configuration files to obtain the necessary information.

mkdir -p /opt/seafile-data/seafile/conf
mkdir -p /opt/seafile

Then download .env and index-server.yml to /opt/seafile in all index-server nodes.

cd /opt/seafile
wget https://manual.seafile.com/12.0/repo/docker/index-server/index-server.yml
wget -O .env https://manual.seafile.com/12.0/repo/docker/index-server/env

Modify mysql configurations in .env.

SEAFILE_MYSQL_DB_HOST=127.0.0.1
SEAFILE_MYSQL_DB_PORT=3306
SEAFILE_MYSQL_DB_USER=seafile
SEAFILE_MYSQL_DB_PASSWORD=PASSWORD

CLUSTER_MODE=master

!!! note CLUSTER_MODE needs to be configured as master on the master node, and needs to be configured as worker on the slave nodes.

Next, create a configuration file index-master.conf in the conf directory of the master node, e.g.

[DEFAULT]
mq_type=redis      # must be redis

[REDIS]
server=127.0.0.1   # your redis server host
port=6379          # your redis server port
password=xxx       # your redis server password, if not password, do not set this item

Start master node.

docker compose up -d

Next, create a configuration file index-worker.conf in the conf directory of all slave nodes, e.g.

[DEFAULT]
mq_type=redis      # must be redis
index_workers=2    # number of threads to create/update indexes, you can increase this value according to your needs

[REDIS]
server=127.0.0.1   # your redis server host
port=6379          # your redis server port
password=xxx       # your redis server password, if not password, do not set this item

Start all slave nodes.

docker compose up -d

Some commands in distributed indexing

Rebuild search index, first execute the command in the Seafile node:

cd /opt/seafile/seafile-server-last/
./pro/pro.py search --clear

Then execute the command in the index-server master node:

docker exec -it index-server bash
/opt/seafile/index-server/index-server.sh restore-all-repo

List the number of indexing tasks currently remaining, execute the command in the index-server master node:

/opt/seafile/index-server/index-server.sh show-all-task