feat: translate chinese to english (#402)

* Checkpoint before follow-up message

Co-authored-by: anzhengchao <anzhengchao@gmail.com>

* Translate project documentation and comments from Chinese to English

Co-authored-by: anzhengchao <anzhengchao@gmail.com>

* Fix typo: "unparseable" to "unparsable" in version test comment

Co-authored-by: anzhengchao <anzhengchao@gmail.com>

* Refactor compression test code with minor syntax improvements

Co-authored-by: anzhengchao <anzhengchao@gmail.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
安正超
2025-08-14 00:19:01 +08:00
committed by GitHub
parent 581607da6a
commit d552210b59
24 changed files with 307 additions and 361 deletions
+4 -4
View File
@@ -14,12 +14,12 @@
for i in {0..3}; do
DIR="/data/rustfs$i"
echo "处理 $DIR"
echo "Processing $DIR"
if [ -d "$DIR" ]; then
echo "清空 $DIR"
echo "Clearing $DIR"
sudo rm -rf "$DIR"/* "$DIR"/.[!.]* "$DIR"/..?* 2>/dev/null || true
echo "已清空 $DIR"
echo "Cleared $DIR"
else
echo "$DIR 不存在,跳过"
echo "$DIR does not exist, skipping"
fi
done
+10 -10
View File
@@ -14,32 +14,32 @@
# limitations under the License.
# 脚本名称:scp_to_servers.sh
# Script name: scp_to_servers.sh
rm ./target/x86_64-unknown-linux-gnu/release/rustfs.zip
# 压缩./target/x86_64-unknown-linux-gnu/release/rustfs
# Compress ./target/x86_64-unknown-linux-gnu/release/rustfs
zip -j ./target/x86_64-unknown-linux-gnu/release/rustfs.zip ./target/x86_64-unknown-linux-gnu/release/rustfs
# 上传到服务器
# Upload to server
LOCAL_FILE="./target/x86_64-unknown-linux-gnu/release/rustfs.zip"
REMOTE_PATH="~"
# 必须传入IP参数,否则报错退出
# IP parameter must be provided, otherwise exit with error
if [ -z "$1" ]; then
echo "用法: $0 <server_ip>"
echo "请传入目标服务器IP地址"
echo "Usage: $0 <server_ip>"
echo "Please provide target server IP address"
exit 1
fi
SERVER_LIST=("root@$1")
# 遍历服务器列表
# Iterate through server list
for SERVER in "${SERVER_LIST[@]}"; do
echo "正在将文件复制到服务器:$SERVER 目标路径:$REMOTE_PATH"
echo "Copying file to server: $SERVER target path: $REMOTE_PATH"
scp "$LOCAL_FILE" "${SERVER}:${REMOTE_PATH}"
if [ $? -eq 0 ]; then
echo "成功复制到 $SERVER"
echo "Successfully copied to $SERVER"
else
echo "复制到 $SERVER 失败"
echo "Failed to copy to $SERVER"
fi
done
+44 -44
View File
@@ -16,9 +16,9 @@
# ps -ef | grep rustfs | awk '{print $2}'| xargs kill -9
# 本地 rustfs.zip 路径
# Local rustfs.zip path
ZIP_FILE="./rustfs.zip"
# 解压目标
# Unzip target
UNZIP_TARGET="./"
@@ -35,119 +35,119 @@ SERVER_LIST=(
REMOTE_TMP="~/rustfs"
# 部署 rustfs 到所有服务器
# Deploy rustfs to all servers
deploy() {
echo "解压 $ZIP_FILE ..."
echo "Unzipping $ZIP_FILE ..."
unzip -o "$ZIP_FILE" -d "$UNZIP_TARGET"
if [ $? -ne 0 ]; then
echo "解压失败,退出"
echo "Unzip failed, exiting"
exit 1
fi
LOCAL_RUSTFS="${UNZIP_TARGET}rustfs"
if [ ! -f "$LOCAL_RUSTFS" ]; then
echo "未找到解压后的 rustfs 文件,退出"
echo "Unzipped rustfs file not found, exiting"
exit 1
fi
for SERVER in "${SERVER_LIST[@]}"; do
echo "上传 $LOCAL_RUSTFS $SERVER:$REMOTE_TMP"
echo "Uploading $LOCAL_RUSTFS to $SERVER:$REMOTE_TMP"
scp "$LOCAL_RUSTFS" "${SERVER}:${REMOTE_TMP}"
if [ $? -ne 0 ]; then
echo "上传到 $SERVER 失败,跳过"
echo "Upload to $SERVER failed, skipping"
continue
fi
echo "$SERVER 上操作 systemctl 和文件替换"
echo "Operating systemctl and file replacement on $SERVER"
ssh "$SERVER" bash <<EOF
set -e
echo "停止 rustfs 服务"
echo "Stopping rustfs service"
sudo systemctl stop rustfs || true
echo "覆盖 /usr/local/bin/rustfs"
echo "Overwriting /usr/local/bin/rustfs"
sudo cp ~/rustfs /usr/local/bin/rustfs
sudo chmod +x /usr/local/bin/rustfs
echo "启动 rustfs 服务"
echo "Starting rustfs service"
sudo systemctl start rustfs
echo "检测 rustfs 服务状态"
echo "Checking rustfs service status"
sudo systemctl status rustfs --no-pager --lines=10
EOF
if [ $? -eq 0 ]; then
echo "$SERVER 部署并重启 rustfs 成功"
echo "$SERVER deployed and restarted rustfs successfully"
else
echo "$SERVER 部署或重启 rustfs 失败"
echo "$SERVER failed to deploy or restart rustfs"
fi
done
}
# 清空 /data/rustfs0~3 目录下所有文件(包括隐藏文件)
# Clear all files (including hidden files) in /data/rustfs0~3 directories
clear_data_dirs() {
for SERVER in "${SERVER_LIST[@]}"; do
echo "清空 $SERVER:/data/rustfs0~3 下所有文件"
echo "Clearing all files in $SERVER:/data/rustfs0~3"
ssh "$SERVER" bash <<EOF
for i in {0..3}; do
DIR="/data/rustfs$i"
echo "处理 $DIR"
if [ -d "$DIR" ]; then
echo "清空 $DIR"
sudo rm -rf "$DIR"/* "$DIR"/.[!.]* "$DIR"/..?* 2>/dev/null || true
echo "已清空 $DIR"
DIR="/data/rustfs\$i"
echo "Processing \$DIR"
if [ -d "\$DIR" ]; then
echo "Clearing \$DIR"
sudo rm -rf "\$DIR"/* "\$DIR"/.[!.]* "\$DIR"/..?* 2>/dev/null || true
echo "Cleared \$DIR"
else
echo "$DIR 不存在,跳过"
echo "\$DIR does not exist, skipping"
fi
done
EOF
done
}
# 控制 rustfs 服务
# Control rustfs service
stop_rustfs() {
for SERVER in "${SERVER_LIST[@]}"; do
echo "停止 $SERVER rustfs 服务"
echo "Stopping $SERVER rustfs service"
ssh "$SERVER" "sudo systemctl stop rustfs"
done
}
start_rustfs() {
for SERVER in "${SERVER_LIST[@]}"; do
echo "启动 $SERVER rustfs 服务"
echo "Starting $SERVER rustfs service"
ssh "$SERVER" "sudo systemctl start rustfs"
done
}
restart_rustfs() {
for SERVER in "${SERVER_LIST[@]}"; do
echo "重启 $SERVER rustfs 服务"
echo "Restarting $SERVER rustfs service"
ssh "$SERVER" "sudo systemctl restart rustfs"
done
}
# 向所有服务器追加公钥到 ~/.ssh/authorized_keys
# Append public key to ~/.ssh/authorized_keys on all servers
add_ssh_key() {
if [ -z "$2" ]; then
echo "用法: $0 addkey <pubkey_file>"
echo "Usage: $0 addkey <pubkey_file>"
exit 1
fi
PUBKEY_FILE="$2"
if [ ! -f "$PUBKEY_FILE" ]; then
echo "指定的公钥文件不存在: $PUBKEY_FILE"
echo "Specified public key file does not exist: $PUBKEY_FILE"
exit 1
fi
PUBKEY_CONTENT=$(cat "$PUBKEY_FILE")
for SERVER in "${SERVER_LIST[@]}"; do
echo "追加公钥到 $SERVER:~/.ssh/authorized_keys"
echo "Appending public key to $SERVER:~/.ssh/authorized_keys"
ssh "$SERVER" "mkdir -p ~/.ssh && chmod 700 ~/.ssh && echo '$PUBKEY_CONTENT' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
if [ $? -eq 0 ]; then
echo "$SERVER 公钥追加成功"
echo "$SERVER public key appended successfully"
else
echo "$SERVER 公钥追加失败"
echo "$SERVER public key append failed"
fi
done
}
monitor_logs() {
for SERVER in "${SERVER_LIST[@]}"; do
echo "监控 $SERVER:/var/logs/rustfs/rustfs.log ..."
echo "Monitoring $SERVER:/var/logs/rustfs/rustfs.log ..."
ssh "$SERVER" "tail -F /var/logs/rustfs/rustfs.log" |
sed "s/^/[$SERVER] /" &
done
@@ -156,32 +156,32 @@ monitor_logs() {
set_env_file() {
if [ -z "$2" ]; then
echo "用法: $0 setenv <env_file>"
echo "Usage: $0 setenv <env_file>"
exit 1
fi
ENV_FILE="$2"
if [ ! -f "$ENV_FILE" ]; then
echo "指定的环境变量文件不存在: $ENV_FILE"
echo "Specified environment variable file does not exist: $ENV_FILE"
exit 1
fi
for SERVER in "${SERVER_LIST[@]}"; do
echo "上传 $ENV_FILE $SERVER:~/rustfs.env"
echo "Uploading $ENV_FILE to $SERVER:~/rustfs.env"
scp "$ENV_FILE" "${SERVER}:~/rustfs.env"
if [ $? -ne 0 ]; then
echo "上传到 $SERVER 失败,跳过"
echo "Upload to $SERVER failed, skipping"
continue
fi
echo "覆盖 $SERVER:/etc/default/rustfs"
echo "Overwriting $SERVER:/etc/default/rustfs"
ssh "$SERVER" "sudo mv ~/rustfs.env /etc/default/rustfs"
if [ $? -eq 0 ]; then
echo "$SERVER /etc/default/rustfs 覆盖成功"
echo "$SERVER /etc/default/rustfs overwritten successfully"
else
echo "$SERVER /etc/default/rustfs 覆盖失败"
echo "$SERVER /etc/default/rustfs overwrite failed"
fi
done
}
# 主命令分发
# Main command dispatcher
case "$1" in
deploy)
deploy
@@ -208,6 +208,6 @@ case "$1" in
set_env_file "$@"
;;
*)
echo "用法: $0 {deploy|clear|stop|start|restart|addkey <pubkey_file>|monitor_logs|setenv <env_file>}"
echo "Usage: $0 {deploy|clear|stop|start|restart|addkey <pubkey_file>|monitor_logs|setenv <env_file>}"
;;
esac
+1 -1
View File
@@ -26,6 +26,6 @@ fi
echo "Creating log directory if it does not exist..."
mkdir -p "$current_dir/deploy/logs/notify"
# 启动 webhook 服务器
# Start webhook server
echo "Starting webhook server..."
cargo run --example webhook -p rustfs-notify &
+22 -22
View File
@@ -47,19 +47,19 @@ export RUSTFS_ADDRESS=":9000"
export RUSTFS_CONSOLE_ENABLE=true
export RUSTFS_CONSOLE_ADDRESS=":9001"
# export RUSTFS_SERVER_DOMAINS="localhost:9000"
# HTTPS 证书目录
# HTTPS certificate directory
# export RUSTFS_TLS_PATH="./deploy/certs"
# 可观测性 相关配置信息
#export RUSTFS_OBS_ENDPOINT=http://localhost:4317 # OpenTelemetry Collector 的地址
#export RUSTFS_OBS_USE_STDOUT=false # 是否使用标准输出
#export RUSTFS_OBS_SAMPLE_RATIO=2.0 # 采样率,0.0-1.0之间,0.0表示不采样,1.0表示全部采样
#export RUSTFS_OBS_METER_INTERVAL=1 # 采样间隔,单位为秒
#export RUSTFS_OBS_SERVICE_NAME=rustfs # 服务名称
#export RUSTFS_OBS_SERVICE_VERSION=0.1.0 # 服务版本
export RUSTFS_OBS_ENVIRONMENT=develop # 环境名称
export RUSTFS_OBS_LOGGER_LEVEL=info # 日志级别,支持 trace, debug, info, warn, error
export RUSTFS_OBS_LOCAL_LOGGING_ENABLED=true # 是否启用本地日志记录
# Observability related configuration
#export RUSTFS_OBS_ENDPOINT=http://localhost:4317 # OpenTelemetry Collector address
#export RUSTFS_OBS_USE_STDOUT=false # Whether to use standard output
#export RUSTFS_OBS_SAMPLE_RATIO=2.0 # Sample ratio, between 0.0-1.0, 0.0 means no sampling, 1.0 means full sampling
#export RUSTFS_OBS_METER_INTERVAL=1 # Sampling interval in seconds
#export RUSTFS_OBS_SERVICE_NAME=rustfs # Service name
#export RUSTFS_OBS_SERVICE_VERSION=0.1.0 # Service version
export RUSTFS_OBS_ENVIRONMENT=develop # Environment name
export RUSTFS_OBS_LOGGER_LEVEL=info # Log level, supports trace, debug, info, warn, error
export RUSTFS_OBS_LOCAL_LOGGING_ENABLED=true # Whether to enable local logging
export RUSTFS_OBS_LOG_DIRECTORY="$current_dir/deploy/logs" # Log directory
export RUSTFS_OBS_LOG_ROTATION_TIME="hour" # Log rotation time unit, can be "second", "minute", "hour", "day"
export RUSTFS_OBS_LOG_ROTATION_SIZE_MB=100 # Log rotation size in MB
@@ -89,34 +89,34 @@ export OTEL_INSTRUMENTATION_SCHEMA_URL="https://opentelemetry.io/schemas/1.31.0"
export OTEL_INSTRUMENTATION_ATTRIBUTES="env=production"
# notify
export RUSTFS_NOTIFY_WEBHOOK_ENABLE="on" # 是否启用 webhook 通知
export RUSTFS_NOTIFY_WEBHOOK_ENDPOINT="http://[::]:3020/webhook" # webhook 通知地址
export RUSTFS_NOTIFY_WEBHOOK_ENABLE="on" # Whether to enable webhook notification
export RUSTFS_NOTIFY_WEBHOOK_ENDPOINT="http://[::]:3020/webhook" # Webhook notification address
export RUSTFS_NOTIFY_WEBHOOK_QUEUE_DIR="$current_dir/deploy/logs/notify"
export RUSTFS_NOTIFY_WEBHOOK_ENABLE_PRIMARY="on" # 是否启用 webhook 通知
export RUSTFS_NOTIFY_WEBHOOK_ENDPOINT_PRIMARY="http://[::]:3020/webhook" # webhook 通知地址
export RUSTFS_NOTIFY_WEBHOOK_ENABLE_PRIMARY="on" # Whether to enable webhook notification
export RUSTFS_NOTIFY_WEBHOOK_ENDPOINT_PRIMARY="http://[::]:3020/webhook" # Webhook notification address
export RUSTFS_NOTIFY_WEBHOOK_QUEUE_DIR_PRIMARY="$current_dir/deploy/logs/notify"
export RUSTFS_NOTIFY_WEBHOOK_ENABLE_MASTER="on" # 是否启用 webhook 通知
export RUSTFS_NOTIFY_WEBHOOK_ENDPOINT_MASTER="http://[::]:3020/webhook" # webhook 通知地址
export RUSTFS_NOTIFY_WEBHOOK_ENABLE_MASTER="on" # Whether to enable webhook notification
export RUSTFS_NOTIFY_WEBHOOK_ENDPOINT_MASTER="http://[::]:3020/webhook" # Webhook notification address
export RUSTFS_NOTIFY_WEBHOOK_QUEUE_DIR_MASTER="$current_dir/deploy/logs/notify"
export RUSTFS_NS_SCANNER_INTERVAL=60 # 对象扫描间隔时间,单位为秒
export RUSTFS_NS_SCANNER_INTERVAL=60 # Object scanning interval in seconds
# exportRUSTFS_SKIP_BACKGROUND_TASK=true
export RUSTFS_COMPRESSION_ENABLED=true # 是否启用压缩
export RUSTFS_COMPRESSION_ENABLED=true # Whether to enable compression
#export RUSTFS_REGION="us-east-1"
# 事件消息配置
# Event message configuration
#export RUSTFS_EVENT_CONFIG="./deploy/config/event.example.toml"
if [ -n "$1" ]; then
export RUSTFS_VOLUMES="$1"
fi
# 启动 webhook 服务器
# Start webhook server
#cargo run --example webhook -p rustfs-notify &
# 启动主服务
# Start main service
cargo run --bin rustfs