我在库伯奈特斯和Neo4j一起工作。作为展示,我想用初始数据填充Pods中的Neo4j,这是我可以用密码文件完成的,我正在使用cypher在/bin文件夹中。因此,基本上我启动容器并运行cat bin/initialData.cypher | bin/cypher-shell。我已经通过在kubectl exec -it <pod> /bin/bash bash中运行它验证了这一点。然而,无论我如何尝试映射到spec.container.command,它都失败了。目前我的猜测是
spec:
containers:
command:
- /bin/bash
- -c
- |
cd bin
ls
cat initialData.cypher | cypher-shell这不起作用。它正确地显示ls,但随后抛出一个connection refused,我不知道它是从哪里来的。
编辑:更新
发布于 2019-06-07 08:07:07
我发现了我的问题所在。我没有意识到这些命令没有链接到初始化生命周期,这意味着在容器中启动neo4j之前执行了该命令。基本上,使用命令对我来说是个错误的方法。
发布于 2019-05-29 08:55:47
您执行了有效的规范,但语法错误。
试着像这样
spec:
containers:
command: ["/bin/bash"]
args: ["-c","cat import/initialData.cypher | bin/cypher-shell"]更新:在您的neo4j.conf中,您必须取消注释与使用新的related相关的行。
# Enable a remote shell server which Neo4j Shell clients can log in to.
dbms.shell.enabled=true
# The network interface IP the shell will listen on (use 0.0.0.0 for all interfaces).
dbms.shell.host=127.0.0.1
# The port the shell will listen on, default is 1337.
dbms.shell.port=1337发布于 2019-05-28 13:39:09
Exec似乎是处理这一问题的更好方法,但通常不会同时使用命令和args。在这种情况下,可能只是把整件事都交给了指挥。
https://stackoverflow.com/questions/56342692
复制相似问题