我已经正确地设置了我的 mesos cluser,它有一个主节点和两个从节点。我想做的是使用 mesos-execute 框架在集群上运行 jar 文件。我可以用它来运行简单的命令,例如:
mesos-execute --master=mesosr:5050 --name="simple-test" --command=echo "hello"
这将按预期运行。但是,如果我尝试用“java -jar helloWorld.jar”之类的东西替换那个 echo“hello”命令,它将不起作用。
我设法找出问题所在,但我不知道如何解决。问题是该命令不是从主目录运行,而是从类似于此的目录运行
/var/lib/mesos/slaves/3f5439b1-7fab-45d6-876e-7e75b7c15fc9-S0/frameworks/3f5439b1-7fab-45d6-876e-7e75b7c15fc9-0043/executors/java-test/runs/7c20baff-080f-48ee-95fc-3662c388744b
我通过在 mesos-execute 上运行“pwd”作为命令获得了该路径。
现在,我的问题是如何离开那里?光盘不起作用。 有没有什么方法可以让我进入主文件夹或一个特殊的文件夹,我可以在其中放置我的 jars 以便 mesos-execute 可以访问它们?
此应用程序的用例是将有许多必须在集群上运行的小 jar 文件。他们不必活着,所以我没有为这些 jar 使用马拉松之类的东西。
谢谢。
最佳答案
--task_group=VALUE
The value could be a JSON-formatted string ofTaskGroupInfo
or a file path containing the JSON-formattedTaskGroupInfo
. Path must be of the formfile:///path/to/file
or/path/to/file
. See theTaskGroupInfo
message inmesos.proto
for the expected format. NOTE:agent_id
need not to be set.
例子:
{
"tasks":
[
{
"name": "Name of the task",
"task_id": {"value" : "Id of the task"},
"agent_id": {"value" : ""},
"resources": [{
"name": "cpus",
"type": "SCALAR",
"scalar": {
"value": 0.1
}
},
{
"name": "mem",
"type": "SCALAR",
"scalar": {
"value": 32
}
}],
"command": {
"value": "sleep 1000"
}
}
]
}
你最感兴趣的是command
部分。在那里你可以定义你的任务,它需要下载才能正确运行的所有文件。 CommandInfo 中指定了所有可能的命令配置选项.
关于jar - 如何使用 mesos-execute 运行 jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43718720/