Skip to content

Commit

Permalink
docs: update production deployment doc (#4829)
Browse files Browse the repository at this point in the history
  • Loading branch information
CaitinChen authored May 9, 2024
1 parent c913942 commit 1a22063
Showing 1 changed file with 34 additions and 31 deletions.
65 changes: 34 additions & 31 deletions docs/en/deployment/production_deployment_recommendations.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,67 +6,70 @@ description: This article is intended as a reference for users who are about to

# Production Deployment Recommendations

This document provides deployment recommendations for JuiceFS community edition in production environments, focusing on monitoring metric collection, automatic metadata backup, trash configuration, background tasks of clients, client log rolling, and command-line auto-completion, to ensure the stability and reliability of the file system.
This document provides deployment recommendations for JuiceFS Community Edition in production environments. It focuses on monitoring metric collection, automatic metadata backup, trash configuration, background tasks of clients, client log rolling, and command-line auto-completion to ensure the stability and reliability of the file system.

## Metrics Collection and Visualization
## Metrics collection and visualization

It is necessary to collect monitoring metrics from JuiceFS clients and visualize them using Grafana, allowing for real-time monitoring of file system performance and health status, as described in this [documentation](../administration/monitoring.md).
It is necessary to collect monitoring metrics from JuiceFS clients and visualize them using Grafana. This allows for real-time monitoring of file system performance and health status. For detailed instructions, see this [document](../administration/monitoring.md).

## Automatic Metadata Backup
## Automatic metadata backup

:::tip
Automatic metadata backup is a feature that has been added since JuiceFS v1.0.0
Automatic metadata backup is a feature that has been added since JuiceFS v1.0.0.
:::

Metadata is critical to JuiceFS file system, and any loss or corruption of metadata may affect a large number of files or even the entire file system. Therefore, metadata must be backed up regularly.
Metadata is critical to the JuiceFS file system, and any loss or corruption of metadata may affect a large number of files or even the entire file system. Therefore, metadata must be backed up regularly.

This feature is enabled by default and the backup interval is 1 hour. The backed up metadata will be compressed and stored in the corresponding object storage (isolated from the file system data). Backups are performed by JuiceFS clients, which may cause an increase in CPU and memory usage during the process, and by default it is assumed that one client will be randomly selected to perform the operation.
This feature is enabled by default and the backup interval is 1 hour. The backed-up metadata is compressed and stored in the corresponding object storage, separate from file system data. Backups are performed by JuiceFS clients, which may increase CPU and memory usage during the process. By default, one client is randomly selected for backup operations.

Note in particular that this feature will be turned off when the number of files reaches **one million**. To turn it on again, you have to set a larger backup interval (the `--backup-meta` option). The interval is configured independently for each client, and the automatic backup can be disabled with `--backup-meta 0`.
It is important to note that this feature is disabled when the number of files reaches **one million**. To re-enable it, set a larger backup interval (the `--backup-meta` option). The interval is configured independently for each client. You can use `--backup-meta 0` to disable automatic backup.

:::note
The time required to back up metadata depends on the specific metadata engine, and different metadata engines will have different performance.
The time required for metadata backup depends on the specific metadata engine. Different metadata engines have different performance.
:::

For a detailed description of automatic metadata backups, please refer to this [documentation](../administration/metadata_dump_load.md#backup-automatically), or you can back up metadata manually. In addition, please also follow the O&M recommendations of the metadata engine you are using to back up your data regularly.
For detailed information on automatic metadata backups, see this [document](../administration/metadata_dump_load.md#backup-automatically). Alternatively, you can back up metadata manually. In addition, follow the operational and maintenance recommendations of the metadata engine you are using to back up your data regularly.

## Trash

:::tip
The Trash feature has been added since JuiceFS v1.0.0
The Trash feature has been available since JuiceFS v1.0.0.
:::

Trash is enabled by default, and the retention time for deleted files defaults to 1 day, which can effectively prevent the risk of loss when data is deleted by mistake.
Trash is enabled by default. The retention time for deleted files defaults to 1 day to mitigate the risk of accidental data loss.

However, when the trash is enabled, it may also bring some side effects. If the application needs to frequently delete files or overwrite them, it will cause the object storage usage to be much larger than the file system. This is because the JuiceFS client will keep deleted files and overwritten blocks on the object storage for a period of time. Therefore, when deploying JuiceFS to a production environment, it is highly recommended to evaluate the workload ahead to get a proper trash configuration. The retention time can be configured in the following way (`--trash-days 0` means to disable trash)
However, enabling Trash may have side effects. If the application needs to frequently delete files or overwrite them, it will cause the object storage usage to be much larger than the file system. This is because the JuiceFS client retain deleted files and overwritten blocks on the object storage for a certain period. Therefore, it is highly recommended to evaluate workload requirements before deploying JuiceFS in a production environment to configure Trash appropriately. You can configure the retention time as follows (`--trash-days 0` disables Trash):

- New filesystem: set via the `--trash-days <value>` option of `juicefs format`
- Existing filesystem: modify with `--trash-days <value>` option of `juicefs config`
- For new file systems: set via the `--trash-days <value>` option of `juicefs format`
- For existing file systems: modify with the `--trash-days <value>` option of `juicefs config`

Please refer to this [documentation](../security/trash.md) for more information about the trash.
For more information on Trash, see this [document](../security/trash.md).

## Client Background Tasks
## Client background tasks

The JuiceFS file system maintains background tasks through clients, which can automatically execute cleaning tasks such as deleting pending files and objects, purging expired files and fragments from the trash, and terminating long-stalled client sessions, etc.
The JuiceFS file system maintains background tasks through clients, which can automatically execute cleaning tasks such as deleting pending files and objects, purging expired files and fragments from Trash, and terminating long-stalled client sessions.

All clients of the same JuiceFS volume share a set of background tasks during runtime. Each task is executed at regular intervals, and which client will be chosen is random. The background tasks include
All clients of the same JuiceFS volume share a set of background tasks during runtime. Each task is executed at regular intervals, with the client chosen randomly. Background tasks include:

1. cleaning up files and objects to be deleted
2. clearing out-of-date files and fragments in the trash
3. cleaning up stale client sessions
4. automatic backup of metadata
- Cleaning up files and objects to be deleted
- Clearing out-of-date files and fragments in Trash
- Cleaning up stale client sessions
- Automatic backup of metadata

Since these tasks take up some resources when executed, you can set the `--no-bgjob` option to disable them for clients with heavy workload.

:::note
Make sure that at least one JuiceFS client can execute background tasks
Make sure that at least one JuiceFS client can execute background tasks.
:::

## Client Log Rotation
## Client log rotation

When running a JuiceFS mount point in the background, the client will output the log to a local file by default. The path to the local log file is slightly different depending on the user running the process: for the root user, the path is `/var/log/juicefs.log`, and for others, it is `$HOME/.juicefs/juicefs.log`.
When running a JuiceFS mount point in the background, the client outputs logs to a local file by default. The path to the local log file is slightly different depending on the user running the process:

The local log file is not rotated by default and needs to be configured manually in production to ensure that it does not take up too much disk space. The following is a configuration example for log rotation
- For the root user, the path is `/var/log/juicefs.log`.
- For others, the path is `$HOME/.juicefs/juicefs.log`.

The local log file is not rotated by default and needs to be configured manually in production to prevent excessive disk space usage. The following is a configuration example for log rotation:

```text title="/etc/logrotate.d/juicefs"
/var/log/juicefs.log {
Expand All @@ -80,14 +83,14 @@ The local log file is not rotated by default and needs to be configured manually
}
```

You can check the correctness of the configuration file with the `logrotate -d` command.
You can check the correctness of the configuration file with the `logrotate -d` command:

```shell
logrotate -d /etc/logrotate.d/juicefs
```

Please refer to this [link](https://linux.die.net/man/8/logrotate) for details about the logrotate configuration.
For details about the logrotate configuration, see this [link](https://linux.die.net/man/8/logrotate).

## Command Line Auto-completion
## Command line auto-completion

JuiceFS provides command line auto-completion scripts for Bash and Zsh to facilitate the use of `juicefs` commands. Please refer to this [documentation](../reference/command_reference.md#Auto-completion) for details.
JuiceFS provides command line auto-completion scripts for Bash and Zsh to facilitate the use of `juicefs` commands. For details, see this [document](../reference/command_reference.md#Auto-completion) for details.

0 comments on commit 1a22063

Please sign in to comment.