# caf-server **Repository Path**: ubml/caf-server ## Basic Information - **Project Name**: caf-server - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-10-17 - **Last Updated**: 2023-11-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # CAF Server [🇨🇳简体中文](README.md) | [🇺🇸English](README.en.md) ## 目录 [[_TOC_]] ## 🚀 快速开始 ### 通过cURL命令下载CAF Server ```shell curl -O https://caf.inspures.com/releases/latest/caf-server-full-latest.tar.gz tar -xzvf ./caf-server-full.tar.gz ``` ### 将CAF Server后台服务启动 ```shell ./caf-server-full-latest/bin/startup.sh ``` ### 停止CAF Server 执行以下命令会优雅的关闭CAF Server,但是通过`caf-server.sh run`命令启动的前台服务无法通过该命令停止。 ```shell ./caf-server-full-latest/bin/shutdown.sh ``` 通常的大型Java应用很难快速的关闭,执行以下命令可在等待宽限期(默认为5秒)后强制终止服务。 ```shell ./caf-server-full-latest/bin/shutdown.sh -force ``` 或者你可以自定义等待宽限期(按秒计算) ```shell ./caf-server-full-latest/bin/shutdown.sh 30 -force ``` ## 🧗 高级使用 在当前窗口前台启动CAF Server,要关闭前台启动的CAF Server需要通过组合健`ctrl` + `c`来完成优雅停机。 ```shell ./caf-server-full-latest/bin/caf-server.sh run ``` 通过远程Debug模式启动CAF Server(默认监听5005端口) ```shell ./caf-server-full-latest/bin/caf-server.sh debug -remote ``` ## 🎛 配置选项 通过修改CAF Server的根目录的下`bin/config.sh`来自定义配置环境变量。所有的可配置变量都在这个文件里,可以通过解开注释置项添加自定义配置。 指定JDK路径: ```conf # Java Development Kit home path (Optional) # Special Notice: # 1. JRE is NOT supported for now, which may cause some functions to be unavailable. # 2. Please do NOT change the default blank value unless you need to specify a dedicated JDK. JAVA_HOME=/usr/Java/jdk1.8.0_181 ``` 自定义JVM内存选项 ```conf # CAF Server memory options (Optional) # Used to specify the running memory size of CAF Server(eg: CAF_MEM_OPTS="-Xmx2048m -Xms512m"). CAF_MEM_OPTS="-Xmx2048m -Xms512m" ``` 添加额外的Java运行时参数 ```conf # Additional Java Runtime arguments (Optional) # Please clearly understand the purpose and impact of the arguments before modifying the default blank value JAVA_OPTS="-XX:-DisableExplicitGC -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:gclog -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp" ``` 修改CAF Server默认的控制台输出文件路径 ```conf # CAF Server console file (Optional) # Full path to a file where stdout and stderr will be redirected. CAF_OUT=$CAF_BASE/nohup.out ``` 修改默认的Debug调试端口号 ```conf # CAF Server debugger address (Optional) # Only available in debug mode. JPDA_ADDRESS=0.0.0.0:8000 ``` 修改默认的盘根目录名 ```conf # CAF Server server path (Required) # The default value of CAF_SERVER_PATH is "server". # You can change it to another directory name, you should keep the following variable value matching with the actual directory name. # Jstack is compatible with the old version, please ignore it. CAF_SERVER_PATH=jstack ``` 修改服务停止时的默认等待宽限期(以秒为单位) ```conf # CAF Server stop grace period in Seconds (Optional) # This value is the amount of time that CAF Server wait after sending a sigterm and give up waiting for the server to exit gracefully. CAF_STOP_GRACE_PERIOD=30 ``` 开启CAF Server的并行启动功能 ```conf # CAF Server parallel init (Optional) # When enabled, Spring Beans will be initialized in parallel. # Optional values: # true Beans will be initialized in parallel. # false Beans will be initialized in the spring default way. CAF_PARALLEL_INIT=true ``` ## 📖 命令参考 ```shell Usage: caf-server.sh ( commands ... ) commands: debug 以本地Debug方式启动CAF Server debug -remote 以JPDA debugger方式启动CAF Server(默认5005端口调试) run 通过前台服务的方式在当前窗口启动CAF Server start 通过后台服务的方式启动CAF Server stop 停止CAF Server,等待一定宽限期(默认5秒),过期后不做处理 stop n 停止CAF Server,等待n秒宽限期,过期后不做处理 stop -force 停止CAF Server,等待一定宽限期(默认5秒),过期后强制终止进程 stop n -force 停止CAF Server,等待n秒宽限期,过期后强制终止进程 ``` ## 🛠 贡献 详情参见 [贡献指南](CONTRIBUTING.md)。