运行 Arango Shell (Arangosh) 在 Kubernetes pod 上
Run Arango Shell (Arangosh) on a Kubernetes pod
我已经在安装在 VM 上的 Kubernetes 节点上设置了一个 Arango 实例,如 ArangoDB 文档中所述 ArangoDB on Kubernetes。请记住,我跳过了 ArangoLocalStorage
和 ArangoDeploymentReplication
这一步。我可以在 get pods.
中看到 3 pods 个代理、协调器和数据库服务器
然而,arango-cluster-ea service
将外部 IP 显示为待处理。我可以使用主节点的 IP 地址和服务端口访问 Web UI,连接到数据库并进行更改。但是我无法访问 Arango shell,也无法使用我的 Python 代码连接到数据库。我在服务中使用 arango-cluster-ea
中显示的主节点 IP 和服务端口来尝试使 Python 代码连接到数据库。同样,对于 arangosh,我正在尝试代码:
kubectl exec -it *arango-cluster-crdn-pod-name* -- arangosh --service.endpoint tcp://masternodeIP:8529
在 Python 的情况下,由于连接 class 调用在 try 块中,它会转到 except 块。在 Arangosh 的情况下,它打开 Arango shell 并出现错误:
Cannot connect to tcp://masternodeIP:port
因此没有连接到数据库。
如有任何线索,我们将不胜感激。
发布此社区 Wiki 答案以指出已解决 issue/question 的 github 问题。
随时edit/expand。
Link 到 github:
Here's how my issue got resolved:
To connect to arangosh, what worked for me was to use ssl before using the localhost:8529 ip-port combination in the server.endpoint. Here's the command that worked:
kubectl exec -it _arango_cluster_crdn_podname_ -- arangosh --server.endpoint ssl://localhost:8529
For web browser, since my external access was based on NodePort type, I put in the master node's IP and the 30000-level port number that was generated (in my case, it was 31200).
For Python, in case of PyArango's Connection class, it worked when I used the arango-cluster-ea service. I put in the following line in the connection call:
conn = Connection(arangoURL='https://arango-cluster-ea:8529', verify= False, username = 'root', password = 'XXXXX')
The verify=False flag is important to ignore the SSL validity, else it will throw an error again.
Hopefully this solves somebody else's issue, if they face the similar issue.
我已经测试了以下解决方案,并且我已经成功地通过以下方式连接到数据库:
arangosh
来自 localhost
:
Connected to ArangoDB 'http+ssl://localhost:8529, version: 3.7.12 [SINGLE, server], database: '_system', username: 'root'
- Python代码
from pyArango.connection import *
conn = Connection(arangoURL='https://ABCD:8529', username="root", password="password",verify= False )
db = conn.createDatabase(name="school")
其他资源:
我已经在安装在 VM 上的 Kubernetes 节点上设置了一个 Arango 实例,如 ArangoDB 文档中所述 ArangoDB on Kubernetes。请记住,我跳过了 ArangoLocalStorage
和 ArangoDeploymentReplication
这一步。我可以在 get pods.
然而,arango-cluster-ea service
将外部 IP 显示为待处理。我可以使用主节点的 IP 地址和服务端口访问 Web UI,连接到数据库并进行更改。但是我无法访问 Arango shell,也无法使用我的 Python 代码连接到数据库。我在服务中使用 arango-cluster-ea
中显示的主节点 IP 和服务端口来尝试使 Python 代码连接到数据库。同样,对于 arangosh,我正在尝试代码:
kubectl exec -it *arango-cluster-crdn-pod-name* -- arangosh --service.endpoint tcp://masternodeIP:8529
在 Python 的情况下,由于连接 class 调用在 try 块中,它会转到 except 块。在 Arangosh 的情况下,它打开 Arango shell 并出现错误:
Cannot connect to tcp://masternodeIP:port
因此没有连接到数据库。
如有任何线索,我们将不胜感激。
发布此社区 Wiki 答案以指出已解决 issue/question 的 github 问题。
随时edit/expand。
Link 到 github:
Here's how my issue got resolved:
To connect to arangosh, what worked for me was to use ssl before using the localhost:8529 ip-port combination in the server.endpoint. Here's the command that worked:
kubectl exec -it _arango_cluster_crdn_podname_ -- arangosh --server.endpoint ssl://localhost:8529
For web browser, since my external access was based on NodePort type, I put in the master node's IP and the 30000-level port number that was generated (in my case, it was 31200).
For Python, in case of PyArango's Connection class, it worked when I used the arango-cluster-ea service. I put in the following line in the connection call:
conn = Connection(arangoURL='https://arango-cluster-ea:8529', verify= False, username = 'root', password = 'XXXXX')
The verify=False flag is important to ignore the SSL validity, else it will throw an error again.Hopefully this solves somebody else's issue, if they face the similar issue.
我已经测试了以下解决方案,并且我已经成功地通过以下方式连接到数据库:
arangosh
来自localhost
:
Connected to ArangoDB 'http+ssl://localhost:8529, version: 3.7.12 [SINGLE, server], database: '_system', username: 'root'
- Python代码
from pyArango.connection import *
conn = Connection(arangoURL='https://ABCD:8529', username="root", password="password",verify= False )
db = conn.createDatabase(name="school")
其他资源: