Skip to content

Commit

Permalink
Merge pull request #121 from 0chain/feat/update-readme
Browse files Browse the repository at this point in the history
Update readme
  • Loading branch information
dabasov committed May 13, 2024
2 parents 42a5c8f + 4dc94c5 commit 7a382c2
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 1 deletion.
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Install from here for your os: https://min.io/docs/minio/macos/index.html
## Configure MinIO Client

```
mc config host add zcn http://localhost:9000 miniouser miniopassword
mc alias set zcn http://localhost:9000 miniouser miniopassword --api S3v2
```

### Examples
Expand Down Expand Up @@ -222,3 +222,43 @@ Check `mc --help` for the exhaustive list of cmds available.
- Use the REST APIs to interact with the server.
- Postman collection for the same is provided below:
[Postman Collection](./assets/Zs3ServerCollection.postman_collection.json)

## Replication

To setup replication, you need to have two zs3servers. For running two zs3servers on the same machine, you will need to copy the contents of .zcn folder to .zcn2 folder and change allocation.txt and zs3server.json accordingly. For changes in docker-compose.yaml, you can refer to the following example:
[docker-compose.yaml](https://github.com/0chain/zs3server/tree/staging/environment/docker-compose-dev2.yaml)

- Configure both the zs3servers using minio client.

```
mc alias set primary http://<HOST_IP>:9000 miniouser miniopassword --api S3v2
mc alias set secondary http://<HOST_IP>:9002 miniouser miniopassword --api S3v2
```

- Set up replication using the following command, for more details refer to [mc mirror](https://min.io/docs/minio/linux/reference/minio-mc/mc-mirror.html) command.

```
./mc mirror primary/<BUCKET_NAME>/ secondary/<BUCKET_NAME/ --remove --watch
```

## Disaster Recovery

Disaster recovery is process of replicating data from secondary to primary in case of primary failure. To set up disaster recovery, you need to have replication setup between primary and secondary zs3servers. In case of primary failure, you can use the following command to sync data from secondary to primary.

```
./mc mirror secondary/<BUCKET_NAME>/ primary/<BUCKET_NAME/ --summary
```

## Encryption and Compression

To enable encryption and compression, you need to provide the encryption and compression options in the zs3server.json file under .zcn folder. For example:

```
{
"encrypt": true,
"compress": true
}
```

If you are using compression, we recommeng using our minio client
[Minio Client](https://github.com/0chain/mc)
73 changes: 73 additions & 0 deletions environment/docker-compose-dev2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
version: '3.8'
services:
db2:
image: postgres:13-alpine
container_name: postgres-db2
restart: always
command: -c "log_statement=all"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
# ports:
# - '5431:5432'
volumes:
- db2:/var/lib/postgresql/data

logsearchapi2:
build: ../logsearchapi
container_name: logsearchapi2
depends_on:
- db2
# ports:
# - 8082:8080
environment:
LOGSEARCH_PG_CONN_STR: "postgres://postgres:postgres@postgres-db2:5432/postgres?sslmode=disable"
LOGSEARCH_AUDIT_AUTH_TOKEN: 1234
MINIO_LOG_QUERY_AUTH_TOKEN: 1234
LOGSEARCH_DISK_CAPACITY_GB: 5
links:
- db2

minioserver2:
build:
context: ../
dockerfile: Dockerfile
container_name: miniserver2
depends_on:
- logsearchapi2
- etcd2
ports:
- 9002:9000
command: ["minio", "gateway", "zcn"]
environment:
MINIO_AUDIT_WEBHOOK_ENDPOINT: http://logsearchapi2:8080/api/ingest?token=1234
MINIO_AUDIT_WEBHOOK_AUTH_TOKEN: 1234
MINIO_AUDIT_WEBHOOK_ENABLE: "on"
MINIO_ROOT_USER: rootroot
MINIO_ROOT_PASSWORD: rootroot
MINIO_BROWSER: "OFF"
MINIO_ETCD_ENDPOINTS: http://etcd2:2379
links:
- logsearchapi2
volumes:
- ~/.zcn2:/root/.zcn

minioclinet2:
build: ../client-api
container_name: miniclient2
depends_on:
- minioserver2
# ports:
# - 3002:3001
environment:
MINIO_SERVER: "miniserver2:9000"

etcd2:
image: 'bitnami/etcd:latest'
container_name: etcd2
environment:
- ALLOW_NONE_AUTHENTICATION=yes
- ETCD_ADVERTISE_CLIENT_URLS=http://etcd2:2379
# ports:
# - 2372:2379
# - 2382:2380

0 comments on commit 7a382c2

Please sign in to comment.