Add S3 installation docs
This commit is contained in:
+2
-1
@@ -6,7 +6,7 @@
|
||||
|
||||
Вернём былую скорость кластерному блочному хранилищу!
|
||||
|
||||
Vitastor - распределённая блочная и файловая SDS (программная СХД), прямой аналог Ceph RBD и CephFS,
|
||||
Vitastor - распределённая блочная, файловая и объектная SDS (программная СХД), прямой аналог Ceph RBD, CephFS и RGW,
|
||||
а также внутренних СХД популярных облачных провайдеров. Однако, в отличие от них, Vitastor
|
||||
быстрый и при этом простой. Только пока маленький :-).
|
||||
|
||||
@@ -46,6 +46,7 @@ Vitastor поддерживает QEMU-драйвер, протоколы NBD и
|
||||
- [OpenNebula](docs/installation/opennebula.ru.md)
|
||||
- [OpenStack](docs/installation/openstack.ru.md)
|
||||
- [Kubernetes CSI](docs/installation/kubernetes.ru.md)
|
||||
- [S3](docs/installation/s3.ru.md)
|
||||
- [Сборка из исходных кодов](docs/installation/source.ru.md)
|
||||
- Конфигурация
|
||||
- [Обзор](docs/config.ru.md)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
Make Clustered Block Storage Fast Again.
|
||||
|
||||
Vitastor is a distributed block and file SDS, direct replacement of Ceph RBD and CephFS,
|
||||
Vitastor is a distributed block, file and object SDS, direct replacement of Ceph RBD, CephFS and RGW,
|
||||
and also internal SDS's of public clouds. However, in contrast to them, Vitastor is fast
|
||||
and simple at the same time. The only thing is it's slightly young :-).
|
||||
|
||||
@@ -46,6 +46,7 @@ Read more details in the documentation. You can start from here: [Quick Start](d
|
||||
- [OpenNebula](docs/installation/opennebula.en.md)
|
||||
- [OpenStack](docs/installation/openstack.en.md)
|
||||
- [Kubernetes CSI](docs/installation/kubernetes.en.md)
|
||||
- [S3](docs/installation/s3.en.md)
|
||||
- [Building from Source](docs/installation/source.en.md)
|
||||
- Configuration
|
||||
- [Overview](docs/config.en.md)
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
# S3 for Vitastor
|
||||
|
||||
The moment has come - Vitastor S3 implementation based on Zenko CloudServer is released.
|
||||
|
||||
## Highlights
|
||||
|
||||
- Zenko CloudServer is implemented in node.js.
|
||||
- Object metadata is stored in MongoDB.
|
||||
- Modified Zenko CloudServer version is used for Vitastor. It is slightly different from
|
||||
the original, has an optimised build and unneeded dependencies are stripped off.
|
||||
- Object data is stored in Vitastor block volumes, but the volume metadata is stored in
|
||||
the same MongoDB, not in Vitastor etcd.
|
||||
- Objects are written to volumes sequentially one after another. The space is allocated
|
||||
with rounding to the sector size (4 KB), so each object takes at least 4 KB.
|
||||
- An important property of such storage scheme is that small objects aren't chunked into
|
||||
parts in Vitastor EC N+K pools and thus don't require reads from all N disks when
|
||||
downloading.
|
||||
- Deleted objects are marked as deleted, but the space is only actually freed during
|
||||
asynchronously executed "defragmentation" process. Defragmentation runs automatically
|
||||
in the background when a volume reaches configured amount of "garbage" (20% by default).
|
||||
Defragmentation copies actual objects to new volume(s) and then removes the old volume.
|
||||
Defragmentation can be configured in locationConfig.json.
|
||||
|
||||
## Plans for future development
|
||||
|
||||
- User account storage in the DB instead of a static file. Original Zenko uses
|
||||
a separate closed-source "Scality Vault" service for it, that's why we use
|
||||
a static file for now.
|
||||
- More detailed documentation.
|
||||
- Support for other (and faster) key-value DBMS for object metadata storage.
|
||||
- Other performance optimisations, for example, related to the used hash function -
|
||||
MD5 used for Amazon compatibility purposes is relatively slow.
|
||||
- Object Lifecycle support. There is a Lifecycle implementation for Zenko called
|
||||
[Backbeat](https://github.com/scality/backbeat) but it's not adapted for Vitastor yet.
|
||||
- Quota support. Original Zenko uses a separate "SCUBA" service for quotas, but
|
||||
it's also proprietary and not available publicly.
|
||||
|
||||
## Installation
|
||||
|
||||
In a few words:
|
||||
|
||||
- Install MongoDB, create a user for S3 metadata DB.
|
||||
- Create a Vitastor pool for S3 data.
|
||||
- Download and setup the Docker container `vitalif/vitastor-zenko`.
|
||||
|
||||
### Setup MongoDB
|
||||
|
||||
You can setup MongoDB yourself, following the [MongoDB manual](https://www.mongodb.com/docs/manual/installation/).
|
||||
|
||||
Or you can follow the instructions below - it describes a simple example of MongoDB setup
|
||||
in Docker (through docker-compose) with 3 replicas.
|
||||
|
||||
1. On each host, create a file `docker-compose.yml` with the content listed below.
|
||||
Replace `<YOUR_PASSWORD>` with your future mongodb administrator password, and optionally
|
||||
replace `0.0.0.0` with `localhost,<server_IP>`. It's recommended to either use a private IP
|
||||
or [setup TLS](https://www.mongodb.com/docs/manual/tutorial/configure-ssl/) afterwards.
|
||||
|
||||
```
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
|
||||
mongo:
|
||||
container_name: mongo
|
||||
image: mongo:7-jammy
|
||||
restart: always
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: root
|
||||
MONGO_INITDB_ROOT_PASSWORD: <YOUR_PASSWORD>
|
||||
network_mode: host
|
||||
volumes:
|
||||
- ./keyfile:/opt/keyfile
|
||||
- ./mongo-data/db:/data/db
|
||||
- ./mongo-data/configdb:/data/configdb
|
||||
entrypoint: /bin/bash -c
|
||||
command: [ "chown mongodb /opt/keyfile && chmod 600 /opt/keyfile && . /usr/local/bin/docker-entrypoint.sh mongod --replSet rs0 --keyFile /opt/keyfile --bind_ip 0.0.0.0" ]
|
||||
```
|
||||
|
||||
2. Generate a shared cluster key using `openssl rand -base64 756 > ./keyfile` and copy
|
||||
that `keyfile` to all hosts.
|
||||
|
||||
3. Start MongoDB on all hosts with `docker compose up -d mongo`.
|
||||
|
||||
4. Enter Mongo Shell with `docker exec -it mongo mongosh -u root -p <YOUR_PASSWORD> localhost/admin`
|
||||
and execute the following command (replace IP addresses `10.10.10.{1,2,3}` with your host IPs):
|
||||
|
||||
`rs.initiate({ _id: 'rs0', members: [
|
||||
{ _id: 1, host: '10.10.10.1:27017' },
|
||||
{ _id: 2, host: '10.10.10.2:27017' },
|
||||
{ _id: 3, host: '10.10.10.3:27017' }
|
||||
] })`
|
||||
|
||||
5. Stay in Mongo Shell and create a user for the future S3 database:
|
||||
|
||||
`db.createUser({ user: 's3', pwd: '<YOUR_S3_PASSWORD>', roles: [
|
||||
{ role: 'readWrite', db: 's3' },
|
||||
{ role: 'dbAdmin', db: 's3' },
|
||||
{ role: 'readWrite', db: 'vitastor' },
|
||||
{ role: 'dbAdmin', db: 'vitastor' }
|
||||
] })`
|
||||
|
||||
### Setup Vitastor
|
||||
|
||||
Create a pool in Vitastor for S3 object data, for example:
|
||||
|
||||
`vitastor-cli create-pool --ec 2+1 -n 512 s3-data --used_for_app s3:standard`
|
||||
|
||||
The `--used_for_app` options works as fool-proofing and prevents you from
|
||||
accidentally creating a regular block volume in the S3 pool and overwriting some S3 data.
|
||||
Also it hides inode space statistics from Vitastor etcd.
|
||||
|
||||
Retrieve the ID of your pool with `vitastor-cli ls-pools s3-data --detail`.
|
||||
|
||||
### Setup Vitastor S3
|
||||
|
||||
1. Add the following lines to `docker-compose.yml` (instead of `network_mode: host`,
|
||||
you can use `ports: [ "8000:8000", "8002:8002" ]`):
|
||||
|
||||
```
|
||||
zenko:
|
||||
container_name: zenko
|
||||
image: vitalif/vitastor-zenko
|
||||
restart: always
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
ulimits:
|
||||
memlock: -1
|
||||
network_mode: host
|
||||
volumes:
|
||||
- /etc/vitastor:/etc/vitastor
|
||||
- /etc/vitastor/s3:/conf
|
||||
```
|
||||
|
||||
2. Download Docker image: `docker pull vitalif/vitastor-zenko`
|
||||
|
||||
3. Extract configuration file examples from the Docker image:
|
||||
```
|
||||
docker run --rm -it -v /etc/vitastor:/etc/vitastor -v /etc/vitastor/s3:/conf vitalif/vitastor-zenko configure.sh
|
||||
```
|
||||
|
||||
4. Edit configuration files in `/etc/vitastor/s3/`:
|
||||
- `config.json` - common settings.
|
||||
- `authdata.json` - user accounts and access keys.
|
||||
- `locationConfig.json` - S3 storage class list with placement settings.
|
||||
Note: it actually contains storage classes (like STANDARD, COLD, etc)
|
||||
instead of "locations" (zones like us-east-1) as in the original Zenko CloudServer.
|
||||
- Put your MongoDB connection data into `config.json` and `locationConfig.json`.
|
||||
- Put your Vitastor pool ID into `locationConfig.json`.
|
||||
- For now, the complete list of Vitastor backend settings is only available [in the code](https://git.yourcmc.ru/vitalif/zenko-arsenal/src/branch/master/lib/storage/data/vitastor/VitastorBackend.ts#L94).
|
||||
|
||||
### Start Zenko
|
||||
|
||||
Start the S3 server with:
|
||||
|
||||
```
|
||||
docker run --restart always --security-opt seccomp:unconfined --ulimit memlock=-1 --network=host \
|
||||
-v /etc/vitastor:/etc/vitastor -v /etc/vitastor/s3:/conf --name zenko vitalif/vitastor-zenko
|
||||
```
|
||||
|
||||
If you use default settings, Zenko CloudServer starts on port 8000.
|
||||
The default access key is `accessKey1` with a secret key of `verySecretKey1`.
|
||||
|
||||
Now you can access your S3 with, for example, [s3cmd](https://s3tools.org/s3cmd):
|
||||
|
||||
```
|
||||
s3cmd --access_key=accessKey1 --secret_key=verySecretKey1 --host=http://localhost:8000 mb s3://testbucket
|
||||
```
|
||||
|
||||
Or even mount it with [GeeseFS](https://github.com/yandex-cloud/geesefs):
|
||||
|
||||
```
|
||||
AWS_ACCESS_KEY_ID=accessKey1 \
|
||||
AWS_SECRET_ACCESS_KEY=verySecretKey1 \
|
||||
geesefs --endpoint http://localhost:8000 testbucket mountdir
|
||||
```
|
||||
|
||||
## Author & License
|
||||
|
||||
- [Zenko CloudServer](https://s3-server.readthedocs.io/en/latest/) author is Scality,
|
||||
licensed under [Apache License, version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
||||
- [Vitastor](https://git.yourcmc.ru/vitalif/vitastor/) and Zenko Vitastor backend author is
|
||||
Vitaliy Filippov, licensed under [VNPL-1.1](https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/VNPL-1.1.txt)
|
||||
(a "network copyleft" license based on AGPL/SSPL, but worded in a better way)
|
||||
- Vitastor S3 repository: https://git.yourcmc.ru/vitalif/zenko-cloudserver-vitastor
|
||||
- Vitastor S3 backend code: https://git.yourcmc.ru/vitalif/zenko-arsenal/src/branch/master/lib/storage/data/vitastor/VitastorBackend.ts
|
||||
@@ -0,0 +1,165 @@
|
||||
# S3 на базе Vitastor
|
||||
|
||||
Итак, свершилось - реализация Vitastor S3 на базе Zenko CloudServer достигла
|
||||
состояния готовности к публикации и использованию.
|
||||
|
||||
## Ключевые особенности
|
||||
|
||||
- Zenko CloudServer реализован на node.js.
|
||||
- Метаданные объектов хранятся в MongoDB.
|
||||
- Поставляется модифицированная версия Zenko CloudServer, отвязанная от лишних зависимостей,
|
||||
с оптимизированной сборкой и немного отличающаяся от оригинала.
|
||||
- Данные объектов хранятся в блочных томах Vitastor, однако информация о самих томах
|
||||
сохраняется не в etcd Vitastor, а тоже в БД на основе MongoDB.
|
||||
- Объекты записываются в тома последовательно друг за другом. Место выделяется с округлением
|
||||
до размера сектора (до 4 килобайт), поэтому каждый объект занимает как минимум 4 КБ.
|
||||
- Благодаря такой схеме записи объектов мелкие объекты не нарезаются на части и поэтому не
|
||||
требуют чтения с N дисков данных в EC N+K пулах Vitastor.
|
||||
- При удалении объекты помечаются удалёнными, но место освобождается не сразу, а при
|
||||
запускаемой асинхронно "дефрагментации". Дефрагментация запускается автоматически в фоне
|
||||
при достижении заданного объёма "мусора" в томе (по умолчанию 20%), копирует актуальные
|
||||
объекты в новые тома, после чего очищает старый том полностью. Дефрагментацию можно
|
||||
настраивать в locationConfig.json.
|
||||
|
||||
## Планы развития
|
||||
|
||||
- Хранение учётных записей в БД, а не в статическом файле (в оригинальном Zenko для
|
||||
этого используется отдельный закрытый сервис "Scality Vault").
|
||||
- Более подробная документация.
|
||||
- Поддержка других (и более производительных) key-value СУБД для хранения метаданных.
|
||||
- Другие оптимизации производительности, например, в области используемой хеш-функции
|
||||
(хеш MD5, используемый в целях совместимости, относительно медленный).
|
||||
- Поддержка Object Lifecycle. Реализация Lifecycle для Zenko существует и называется
|
||||
[Backbeat](https://github.com/scality/backbeat), но она ещё не адаптирована для Vitastor.
|
||||
- Квоты. В оригинальном Zenko для этого используется отдельный сервис "SCUBA", однако
|
||||
он тоже является закрытым и недоступен для публичного использования.
|
||||
|
||||
## Установка
|
||||
|
||||
Кратко:
|
||||
|
||||
- Установите MongoDB, создайте пользователя для БД метаданных S3.
|
||||
- Создайте в Vitastor пул для хранения данных объектов.
|
||||
- Скачайте и настройте Docker-контейнер `vitalif/vitastor-zenko`.
|
||||
|
||||
### Установка MongoDB
|
||||
|
||||
Вы можете установить MongoDB сами, следуя [официальному руководству MongoDB](https://www.mongodb.com/docs/manual/installation/).
|
||||
|
||||
Либо вы можете последовать инструкции, приведённой ниже - здесь описан простейший пример
|
||||
установки MongoDB в Docker (docker-compose) в конфигурации с 3 репликами.
|
||||
|
||||
1. На всех 3 серверах создайте файл `docker-compose.yml`, заменив `<ВАШ_ПАРОЛЬ>`
|
||||
на собственный будущий пароль администратора mongodb, а `0.0.0.0` по желанию
|
||||
заменив на на `localhost,<IP_сервера>` - желательно либо использовать публично не доступный IP,
|
||||
либо потом [настроить TLS](https://www.mongodb.com/docs/manual/tutorial/configure-ssl/).
|
||||
|
||||
```
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
|
||||
mongo:
|
||||
container_name: mongo
|
||||
image: mongo:7-jammy
|
||||
restart: always
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: root
|
||||
MONGO_INITDB_ROOT_PASSWORD: <ВАШ_ПАРОЛЬ>
|
||||
network_mode: host
|
||||
volumes:
|
||||
- ./keyfile:/opt/keyfile
|
||||
- ./mongo-data/db:/data/db
|
||||
- ./mongo-data/configdb:/data/configdb
|
||||
entrypoint: /bin/bash -c
|
||||
command: [ "chown mongodb /opt/keyfile && chmod 600 /opt/keyfile && . /usr/local/bin/docker-entrypoint.sh mongod --replSet rs0 --keyFile /opt/keyfile --bind_ip 0.0.0.0" ]
|
||||
```
|
||||
|
||||
2. В той же директории сгенерируйте общий ключ кластера командой `openssl rand -base64 756 > ./keyfile`
|
||||
и скопируйте этот файл на все 3 сервера.
|
||||
|
||||
3. На всех 3 серверах запустите MongoDB командой `docker compose up -d mongo`.
|
||||
|
||||
4. Зайдите в Mongo Shell с помощью команды `docker exec -it mongo mongosh -u root -p <ВАШ_ПАРОЛЬ> localhost/admin`
|
||||
и там выполните команду (заменив IP-адреса `10.10.10.{1,2,3}` на адреса своих серверов):
|
||||
|
||||
`rs.initiate({ _id: 'rs0', members: [
|
||||
{ _id: 1, host: '10.10.10.1:27017' },
|
||||
{ _id: 2, host: '10.10.10.2:27017' },
|
||||
{ _id: 3, host: '10.10.10.3:27017' }
|
||||
] })`
|
||||
|
||||
5. Находясь там же, в Mongo Shell, создайте пользователя с доступом к будущей базе данных S3:
|
||||
|
||||
`db.createUser({ user: 's3', pwd: '<ВАШ_ПАРОЛЬ_S3>', roles: [
|
||||
{ role: 'readWrite', db: 's3' },
|
||||
{ role: 'dbAdmin', db: 's3' },
|
||||
{ role: 'readWrite', db: 'vitastor' },
|
||||
{ role: 'dbAdmin', db: 'vitastor' }
|
||||
] })`
|
||||
|
||||
### Настройка Vitastor
|
||||
|
||||
Создайте в Vitastor отдельный пул для данных объектов S3, например:
|
||||
|
||||
`vitastor-cli create-pool --ec 2+1 -n 512 s3-data --used_for_app s3:standard`
|
||||
|
||||
Опция `--used_for_app` работает как "защита от дурака" и не даёт вам случайно создать
|
||||
в этом пуле обычный блочный том и перезаписать им какие-то данные S3, а также скрывает
|
||||
статистику занятого места по томам S3 из etcd.
|
||||
|
||||
Получите ID своего пула с помощью команды `vitastor-cli ls-pools --detail`.
|
||||
|
||||
### Установка Vitastor S3
|
||||
|
||||
1. Добавьте в `docker-compose.yml` строки (альтернативно вместо `network_mode: host`
|
||||
можно использовать `ports: [ "8000:8000", "8002:8002" ]`):
|
||||
|
||||
```
|
||||
zenko:
|
||||
container_name: zenko
|
||||
image: vitalif/vitastor-zenko
|
||||
restart: always
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
ulimits:
|
||||
memlock: -1
|
||||
network_mode: host
|
||||
volumes:
|
||||
- /etc/vitastor:/etc/vitastor
|
||||
- /etc/vitastor/s3:/conf
|
||||
```
|
||||
|
||||
2. Извлеките из Docker-образа Vitastor примеры файлов конфигурации:
|
||||
`docker run --rm -it -v /etc/vitastor:/etc/vitastor -v /etc/vitastor/s3:/conf vitalif/vitastor-zenko configure.sh`
|
||||
|
||||
3. Отредактируйте файлы конфигурации в `/etc/vitastor/s3/`:
|
||||
- `config.json` - общие настройки.
|
||||
- `authdata.json` - учётные записи и ключи доступа.
|
||||
- `locationConfig.json` - список классов хранения S3 с настройками расположения.
|
||||
Внимание: в данной версии это именно список S3 storage class-ов (STANDARD, COLD и т.п.),
|
||||
а не зон (подобных us-east-1), как в оригинальном Zenko CloudServer.
|
||||
- В `config.json` и в `locationConfig.json` пропишите свои данные подключения к MongoDB.
|
||||
- В `locationConfig.json` укажите ID пула Vitastor для хранения данных.
|
||||
- Полный перечень настроек Vitastor-бэкенда пока можно посмотреть [в коде](https://git.yourcmc.ru/vitalif/zenko-arsenal/src/branch/master/lib/storage/data/vitastor/VitastorBackend.ts#L94).
|
||||
|
||||
### Запуск
|
||||
|
||||
Запустите S3-сервер: `docker-compose up -d zenko`
|
||||
|
||||
Готово! Вы получили S3-сервер, работающий на порту 8000.
|
||||
|
||||
Можете попробовать обратиться к нему с помощью, например, [s3cmd](https://s3tools.org/s3cmd):
|
||||
|
||||
`s3cmd --host-bucket= --no-ssl --access_key=accessKey1 --secret_key=verySecretKey1 --host=http://localhost:8000 mb s3://testbucket`
|
||||
|
||||
Или смонтировать его с помощью [GeeseFS](https://github.com/yandex-cloud/geesefs):
|
||||
|
||||
`AWS_ACCESS_KEY_ID=accessKey1 AWS_SECRET_ACCESS_KEY=verySecretKey1 geesefs --endpoint http://localhost:8000 testbucket /mnt/geesefs`
|
||||
|
||||
## Лицензия
|
||||
|
||||
- Автор [Zenko CloudServer](https://s3-server.readthedocs.io/en/latest/) - Scality, лицензия [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
||||
- Vitastor-бэкенд для S3, как и сам Vitastor, лицензируется на условиях [VNPL 1.1](https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/VNPL-1.1.txt)
|
||||
- Репозиторий сборки: https://git.yourcmc.ru/vitalif/zenko-cloudserver-vitastor
|
||||
- Бэкенд хранения данных: https://git.yourcmc.ru/vitalif/zenko-arsenal/src/branch/master/lib/storage/data/vitastor/VitastorBackend.ts
|
||||
@@ -37,6 +37,7 @@
|
||||
- [Experimental internal etcd replacement - antietcd](../config/monitor.en.md#use_antietcd)
|
||||
- [Built-in Prometheus metric exporter](../config/monitor.en.md#enable_prometheus)
|
||||
- [NFS RDMA support](../usage/nfs.en.md#rdma) (probably also usable for GPUDirect)
|
||||
- [S3](../installation/s3.en.md)
|
||||
|
||||
## Plugins and tools
|
||||
|
||||
@@ -63,7 +64,6 @@ The following features are planned for the future:
|
||||
- iSCSI and NVMeoF gateways
|
||||
- Multi-threaded client
|
||||
- Faster failover
|
||||
- S3
|
||||
- Tiered storage (SSD caching)
|
||||
- NVDIMM support
|
||||
- Compression (possibly)
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
- [Экспериментальная встроенная замена etcd - antietcd](../config/monitor.ru.md#use_antietcd)
|
||||
- [Встроенный Prometheus-экспортер метрик](../config/monitor.ru.md#enable_prometheus)
|
||||
- [Поддержка NFS RDMA](../usage/nfs.ru.md#rdma) (вероятно, также подходящая для GPUDirect)
|
||||
- [S3](../installation/s3.ru.md)
|
||||
|
||||
## Драйверы и инструменты
|
||||
|
||||
@@ -63,7 +64,6 @@
|
||||
- iSCSI и NVMeoF прокси
|
||||
- Многопоточный клиент
|
||||
- Более быстрое переключение при отказах
|
||||
- S3
|
||||
- Поддержка SSD-кэширования (tiered storage)
|
||||
- Поддержка NVDIMM
|
||||
- Возможно, сжатие
|
||||
|
||||
Reference in New Issue
Block a user