确认您是否已成功配置了Jupyter Notebook并正确连接到您的AWS Neptune数据库。
在gremlin-console.yaml文件中,找到WebSocket配置,确保端口号为8182,这是Neptune数据库WebSocket默认端口号。
在Jupyter Notebook中运行以下Python代码来确认WebSocket是否正常连接并返回图形输出:
%config GremlinClient.host = 'your-neptune-endpoint'
%config GremlinClient.port = 8182
%config GremlinClient.message_serializer = 'application/vnd.gremlin-v3.0+json'
%config GremlinClient.username = 'your-neptune-username'
%config GremlinClient.password = 'your-neptune-password'
import gremlin_python.driver.protocol as protocl
import gremlin_python.driver.graph as graph
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
remote_conn = DriverRemoteConnection('ws://your-neptune-endpoint:8182/gremlin', 'g')
g = graph.Graph().traversal().withRemote(remote_conn)
g.V().count().next()
remote_conn.close()
如果步骤3返回了正确的图表输出,那么您需要检查以下配置文件并使图表页可见:
# 找到gremlin-server.yaml文件中的插件配置部分,并取消注释以下代码。这将启用TinkerPop插件,并使图表输出变得可见。
gremlin-server:
plugins:
- io.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin
scriptEngines:
gremlin-groovy:
plugins:
- io.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin
重新启动AWS Neptune以使更改生效。 然后再次运行Jupyter Notebook并确认图表页是否可见。