Apache InLong 2.4.0 常用 CLI 命令与工具详解
详解 Apache InLong 2.4.0 常用 CLI 命令与工具,覆盖 managerctl 全量子命令实测帮助、组件启停脚本、curl 调用 Manager REST API 创建数据接入任务等场景,附真实回显
Apache InLong 2.4.0 常用 CLI 命令与工具详解
目标:整理 Apache InLong 2.4.0 的命令行工具与常用运维命令,包括 managerctl 资源管理工具、各组件启停脚本、基于 curl 的 Manager REST API 调用与数据接入任务创建实测,所有帮助输出与回显均来自 Ubuntu 22.04.5 实测环境(
/opt/data/inlong/apache-inlong-2.4.0)。
一、环境信息
- 操作系统:Ubuntu 22.04.5 LTS,OpenJDK 17.0.20.1
- Apache InLong:2.4.0,安装目录
/opt/data/inlong/apache-inlong-2.4.0(下文INLONG_HOME) - Manager:8083(REST API 前缀
/inlong/manager) - 示例账号:
admin/q1w2e3r4
二、工具概览
| 工具 | 位置 | 用途 |
|---|---|---|
managerctl | INLONG_HOME/inlong-manager/bin/managerctl | 资源(group/stream/cluster)命令行管理 |
startup.sh / restart.sh / shutdown.sh | INLONG_HOME/inlong-manager/bin/ | Manager 启停 |
agent.sh | INLONG_HOME/inlong-agent/bin/agent.sh | Agent 启动/停止/状态/重启/清理 |
dataproxy-start.sh / dataproxy-stop.sh | INLONG_HOME/inlong-dataproxy/bin/ | DataProxy 启停 |
proxy-start.sh / store-start.sh | INLONG_HOME/inlong-audit/bin/ | Audit Proxy / Store 启动 |
| curl | 系统自带 | 调用 Manager REST API |
| mysql 客户端 | 系统自带 | 查看 Manager 元数据库 |
三、前置条件
- 已完成《Ubuntu 22.04 安装 Apache InLong 2.4.0 指南》部署,Manager 8083 正常监听;
- managerctl 依赖
conf/application.properties中的连接配置:
server.host=127.0.0.1
server.port=8083
default.admin.user=admin
default.admin.password=q1w2e3r4
💡 说明:managerctl 从该文件读取 Manager 地址与默认管理员凭据完成登录,无需手工带 token。
四、工具详解
4.1 managerctl 全局帮助
cd /opt/data/inlong/apache-inlong-2.4.0/inlong-manager
JAVA_OPT="-Xms256m -Xmx512m" bin/managerctl
实测回显:
Usage: managerctl [options] [command] [command options]
Options:
-h, --help
Get all command about managerctl.
Commands:
list Displays summary information about one or more resources
Usage: list [options]
describe Display details of one resource
Usage: describe [options]
create Create resource by json file
Usage: create [options]
suspend Suspend resource by group id
Usage: suspend [options]
restart Restart resource by group id
Usage: restart [options]
delete Delete resource by group id
Usage: delete [options]
update Update resource by json file
Usage: update [options]
log Log resource
Usage: log [options]
💡 说明:
JAVA_OPT为本工具 JVM 参数入口,可按规范传-Xms256m -Xmx512m限制堆内存。
4.2 managerctl list(资源列表)
JAVA_OPT="-Xms256m -Xmx512m" bin/managerctl list --help
实测回显:
Usage: managerctl list [command] [command options]
Commands:
stream Get stream summary information
Usage: stream [options]
Options:
* -g, --group
inlong group id
group Get group summary information
Usage: group [options]
Options:
-g, --group
inlong group id
-n, --num
the number displayed
示例:列出 group(需要 Manager 侧已存在 group,若未创建会提示请求失败,可先按「4.5」创建):
JAVA_OPT="-Xms256m -Xmx512m" bin/managerctl list group
4.3 managerctl create(按 JSON 文件创建资源)
JAVA_OPT="-Xms256m -Xmx512m" bin/managerctl create --help
实测回显:
Usage: managerctl create [command] [command options]
Commands:
group Create group by json file
Usage: group [options]
Options:
-f, --file
json file
cluster Create cluster by json file
Usage: cluster [options]
Options:
-f, --file
json file
示例(先写 group JSON 文件再创建):
cat > /tmp/group.json <<'EOF'
{"name":"cli_group","groupName":"cli_group","inCharges":"admin","mqType":"PULSAR","inlongGroupId":"pg_cli_001"}
EOF
JAVA_OPT="-Xms256m -Xmx512m" bin/managerctl create group -f /tmp/group.json
4.4 managerctl describe / suspend / restart / delete / update / log
JAVA_OPT="-Xms256m -Xmx512m" bin/managerctl describe --help
实测回显:
Usage: managerctl describe [command] [command options]
Commands:
stream Get stream details
Usage: stream [options]
Options:
* -g, --group
inlong group id
group Get group details
Usage: group [options]
Options:
* -g, --group
inlong group id
其余子命令用法(实测帮助汇总):
JAVA_OPT="-Xms256m -Xmx512m" bin/managerctl suspend --help # -g <groupId>
JAVA_OPT="-Xms256m -Xmx512m" bin/managerctl restart --help # -g <groupId>
JAVA_OPT="-Xms256m -Xmx512m" bin/managerctl delete --help # -g <groupId>
JAVA_OPT="-Xms256m -Xmx512m" bin/managerctl update --help # -f <json文件>
JAVA_OPT="-Xms256m -Xmx512m" bin/managerctl log --help
4.5 基于 curl 的 Manager REST API(实测)
登录(示例账号 admin / q1w2e3r4,实测回显):
curl -s -c /tmp/inlong_cookie.txt -X POST \
http://127.0.0.1:8083/inlong/manager/api/anno/login \
-H 'Content-Type: application/json' \
-d '{"username":"admin","password":"q1w2e3r4"}'
实测回显:
{"success":true,"errMsg":null,"data":true}
创建数据接入组(group),实测回显:
curl -s -b /tmp/inlong_cookie.txt -X POST \
http://127.0.0.1:8083/inlong/manager/api/group/save \
-H 'Content-Type: application/json' \
-d '{"name":"test_group","groupName":"test_group","inCharges":"admin","mqType":"PULSAR","version":0,"inlongGroupId":"pg_test_001"}'
实测回显:
{"success":true,"errMsg":null,"data":"pg_test_001"}
创建数据流(stream),实测回显:
curl -s -b /tmp/inlong_cookie.txt -X POST \
http://127.0.0.1:8083/inlong/manager/api/stream/save \
-H 'Content-Type: application/json' \
-d '{"inlongGroupId":"pg_test_001","inlongStreamId":"st_test_01","name":"st_test_01","dataType":"TEXT","version":0}'
实测回显:
{"success":true,"errMsg":null,"data":1}
查询 group 列表(POST),实测回显:
curl -s -b /tmp/inlong_cookie.txt -X POST \
http://127.0.0.1:8083/inlong/manager/api/group/list \
-H 'Content-Type: application/json' \
-d '{"pageNum":1,"pageSize":10}'
实测回显(节选):
{"success":true,"errMsg":null,"data":{"list":[{"id":1,"inlongGroupId":"pg_test_001","inlongGroupMode":0,"name":"test_group","mqType":"PULSAR","mqResource":"pg_test_001","inlongClusterTag":null,"extParams":"{\"pulsarTenant\":null,\"queueModule\":\"PARALLEL\",\"partitionNum\":3,...}","inCharges":"admin","status":100,"creator":"admin","modifier":"admin","createTime":"2026-10-11T10:34:00.000+0800","modifyTime":"2026-10-11T10:34:00.000+0800","streamSources":null}],"total":1,"pageSize":10,"pageNum":1}}
💡 说明:
status:100表示数据接入组处于「草稿/已创建」状态;创建 group 后数据同时落库,可用 mysql 验证:
mysql -uroot -pinlong -e "select id,inlong_group_id,name,mq_type,status from apache_inlong_manager.inlong_group;"
实测回显:
id inlong_group_id name mq_type status
1 pg_test_001 test_group PULSAR 100
查询用户信息,实测回显:
curl -s -b /tmp/inlong_cookie.txt \
http://127.0.0.1:8083/inlong/manager/api/user/getByName/admin
实测回显(节选):
{"success":true,"errMsg":null,"data":{"id":1,"name":"admin","tenant":null,"password":"1976e096b31cfda81269d0df2775466aac6dd809e3ada1d5ba7831d85e80f109","secretKey":"9B5DCE950F284141D5493A2DAFEBD1BFEECE075FC5F426E8B67F33F14876E2D0","encryptVersion":1,"accountType":0,"validDays":26744,"creator":"inlong_init",...}}
4.6 组件启停脚本(实测)
Manager 启动:
cd /opt/data/inlong/apache-inlong-2.4.0/inlong-manager
export MANAGER_JVM_HEAP_OPTS="-Xms256m -Xmx512m"
bin/startup.sh
Agent 状态/启动/停止(每命令单独执行):
cd /opt/data/inlong/apache-inlong-2.4.0/inlong-agent
export AGENT_JVM_HEAP_OPTS="-Xms256m -Xmx512m"
bin/agent.sh status
bin/agent.sh start
bin/agent.sh stop
DataProxy:
cd /opt/data/inlong/apache-inlong-2.4.0/inlong-dataproxy
export DATAPROXY_JVM_HEAP_OPTS="-Xms256m -Xmx512m -XX:MaxDirectMemorySize=512m"
bin/dataproxy-start.sh pulsar
bin/dataproxy-stop.sh
Audit:
cd /opt/data/inlong/apache-inlong-2.4.0/inlong-audit
export AUDIT_JVM_HEAP_OPTS="-Xms256m -Xmx512m"
bin/proxy-start.sh
bin/store-start.sh
bin/proxy-stop.sh
bin/store-stop.sh
端口验证(实测方式,逐个探测):
(echo > /dev/tcp/127.0.0.1/8083) && echo "Manager 8083 OPEN"
(echo > /dev/tcp/127.0.0.1/46801) && echo "DataProxy 46801 OPEN"
(echo > /dev/tcp/127.0.0.1/46802) && echo "DataProxy 46802 OPEN"
(echo > /dev/tcp/127.0.0.1/10081) && echo "Audit 10081 OPEN"
实测回显:
Manager 8083 OPEN
DataProxy 46801 OPEN
DataProxy 46802 OPEN
Audit 10081 OPEN
进程与 JVM 参数确认(实测回显节选):
ps -ef | grep [j]ava | grep InlongManagerMain
root ... java -server -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m -XX:-OmitStackTraceInFastThrow -Xms256m -Xmx512m ... org.apache.inlong.manager.web.InlongManagerMain
五、注意事项
- managerctl 凭据:读取
conf/application.properties的server.host/server.port/default.admin.user/default.admin.password,修改密码后需同步该文件; - 登录接口变化:InLong 2.x 登录端点为
/inlong/manager/api/anno/login(旧版本为/anno/account/login,实测返回 404,勿混用); - API 前缀:REST API 统一以
/inlong/manager/api开头(server.servlet.context-path=/inlong/manager); - 403 含义:未登录调用业务 API 返回
{"status":403,"error":"Forbidden"}属正常鉴权拦截,登录后(cookie 携带JSESSIONID)即可访问; - 每实例命令逐个执行:多组件启停命令各自单独执行,禁止批量循环。
六、常见问题(FAQ)
Q1:managerctl list group 提示 "Request to Inlong /inlong/manager/api/group/list failed:"?
多为 Manager 侧尚未创建任何 group,或 conf/application.properties 凭据与 Manager 数据库 user 表密码(SimpleHash 迭代哈希)不一致;先按 4.5 用 curl 登录验证,再修配置。
Q2:curl 登录返回 {"success":false,"errMsg":"Username or password was incorrect, or the account has expired"}?
密码错误或账号过期(user.due_date)。默认账号 admin/q1w2e3r4,如曾被修改,用《安装指南》5.3 的方式重置哈希。
Q3:/actuator/health 404?
Manager 未启用 Actuator 端点,健康检查用登录接口或 GET /inlong/manager/api/user/getByName/admin 即可。
Q4:agent.sh status 显示 not running 但进程存在?
agent.sh status 按 inlong-agent 进程名匹配,若手工以 java -cp ... AgentMain 启动(无进程名标识)会识别不到,统一用 bin/agent.sh start 启动。
七、参考链接
- Apache InLong 官方文档:https://inlong.apache.org/docs/next/
- REST API 说明:https://inlong.apache.org/docs/next/user_guide/management_api/
- 安装指南:《Ubuntu 22.04 安装 Apache InLong 2.4.0 指南》
- 配置参考:《Apache InLong 2.4.0 配置参数详解》