Setup With Ceph

    Ceph is a scalable distributed storage system. Seafile can use Ceph’s RADOS object storage layer for storage backend.

    Seafile acts as a client to Ceph/RADOS, so it needs to access ceph cluster’s conf file and keyring. You have to copy these files from a ceph admin node’s /etc/ceph directory to the seafile machine.

    Install and enable memcached

    For best performance, Seafile requires install memcached and enable memcache for objects.

    We recommend to allocate 128MB memory for memcached. Edit /etc/memcached.conf

    1. # Note that the daemon will grow to this size, but does not start out holding this much
    2. # memory
    3. # -m 64
    4. -m 128

    On Debian/Ubuntu:

    1. sudo apt-get install python-ceph

    On RedHat/CentOS:

    Edit seafile configuration

    Edit seafile.conf, add the following lines:

    1. [block_backend]
    2. name = ceph
    3. ceph_config = /etc/ceph/ceph.conf
    4. pool = seafile-blocks
    5. memcached_options = --SERVER=localhost --POOL-MIN=10 --POOL-MAX=100
    6. name = ceph
    7. ceph_config = /etc/ceph/ceph.conf
    8. pool = seafile-commits
    9. memcached_options = --SERVER=localhost --POOL-MIN=10 --POOL-MAX=100
    10. [fs_object_backend]
    11. name = ceph
    12. ceph_config = /etc/ceph/ceph.conf
    13. pool = seafile-fs
    14. memcached_options = --SERVER=localhost --POOL-MIN=10 --POOL-MAX=100

    It’s recommended to create separate pools for commit, fs, and block objects.

    1. ceph-admin-node# rados mkpool seafile-blocks
    2. ceph-admin-node# rados mkpool seafile-commits
    3. ceph-admin-node# rados mkpool seafile-fs

    Notice that there is a --RETRY-TIMEOUT=3600 option in the above config. This option is important for dealing with memcached server failures. After a memcached server in the cluster fails, Seafile server will stop trying to use it for “RETRY-TIMEOUT” (in seconds). You should set this timeout to relatively long time, to prevent Seafile from retrying the failed server frequently, which may lead to frequent request errors for the clients.

    Since version 5.1.0 version, we upgraded the bundled Ceph rados library to 0.94.6. On Ubuntu 16.04, this causes some incompatibility. To work around this issue, you have to install librados 0.94.6 in the Ubuntu system (from Ceph’s official repositories) and let Seafile use the library from system. To do this, you have to remove a few bundled libraries:

    1. cd seafile-server-latest/seafile/lib
    2. rm librados.so.2 libstdc++.so.6 libnspr4.so

    Use arbitary Ceph user

    The above configuration will use the default (client.admin) user to connect to Ceph.
    You may want to use some other Ceph user to connect. This is supported in Seafile.
    To specify the Ceph user, you have to add a ceph_client_id option to seafile.conf, as the following:

    1. [block_backend]
    2. name = ceph
    3. ceph_config = /etc/ceph/ceph.conf
    4. # Sepcify Ceph user for Seafile here
    5. memcached_options = --SERVER=localhost --POOL-MIN=10 --POOL-MAX=100
    6. [commit_object_backend]
    7. name = ceph
    8. ceph_config = /etc/ceph/ceph.conf
    9. # Sepcify Ceph user for Seafile here
    10. ceph_client_id = seafile
    11. pool = seafile-commits
    12. memcached_options = --SERVER=localhost --POOL-MIN=10 --POOL-MAX=100
    13. [fs_object_backend]
    14. name = ceph
    15. ceph_config = /etc/ceph/ceph.conf
    16. # Sepcify Ceph user for Seafile here
    17. ceph_client_id = seafile
    18. pool = seafile-fs
    19. memcached_options = --SERVER=localhost --POOL-MIN=10 --POOL-MAX=100

    You can create a ceph user for seafile on your ceph cluster like this: