neo4j安装
neo4j下载地址:https://neo4j.com/download-center/,选择相应的社区版本。
Java8下载地址(需注册):
neo4j修改密码
由于用的是云服务器没有UI界面,没办法通过上面那种方法来修改密码,可以通过使用cypher-shell来解决。
在neo4j的bin目录下,运行 :./cypher-shell 来进入到cypher-shell。初始用户名 和 密码都是neo4j。
CALL dbms.changePassword('新密码');
运行成功后运行下面命令退出即可。
:exit
报错解决
完整报错:
Traceback (most recent call last):
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/connection.py”, line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/util/connection.py”, line 83, in create_connection
raise err
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/util/connection.py”, line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/connectionpool.py”, line 601, in urlopen
chunked=chunked)
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/connectionpool.py”, line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File “/usr/lib/python3.5/http/client.py”, line 1106, in request
self._send_request(method, url, body, headers)
File “/usr/lib/python3.5/http/client.py”, line 1151, in _send_request
self.endheaders(body)
File “/usr/lib/python3.5/http/client.py”, line 1102, in endheaders
self._send_output(message_body)
File “/usr/lib/python3.5/http/client.py”, line 934, in _send_output
self.send(msg)
File “/usr/lib/python3.5/http/client.py”, line 877, in send
self.connect()
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/connection.py”, line 166, in connect
conn = self._new_conn()
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/connection.py”, line 150, in _new_conn
self, “Failed to establish a new connection: %s” % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fce9c075ac8>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/Ai/env/lib/python3.5/site-packages/py2neo/internal/http.py”, line 134, in request
return self._http.request(method, url, fields, headers, **urlopen_kw)
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/request.py”, line 70, in request
**urlopen_kw)
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/request.py”, line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/connectionpool.py”, line 668, in urlopen
**response_kw)
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/connectionpool.py”, line 668, in urlopen
**response_kw)
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/connectionpool.py”, line 668, in urlopen
**response_kw)
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/connectionpool.py”, line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File “/home/Ai/env/lib/python3.5/site-packages/urllib3/util/retry.py”, line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=‘127.0.0.1:7474’, port=None): Max retries exceeded with url: /db/data/transaction/commit (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x7fce9c075ac8>: Failed to establish a new connection: [Errno 111] Connection refused’,))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/Ai/env/lib/python3.5/site-packages/flask/app.py”, line 2292, in wsgi_app
response = self.full_dispatch_request()
File “/home/Ai/env/lib/python3.5/site-packages/flask/app.py”, line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/home/Ai/env/lib/python3.5/site-packages/flask_cors/extension.py”, line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File “/home/Ai/env/lib/python3.5/site-packages/flask/app.py”, line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/home/Ai/env/lib/python3.5/site-packages/flask/_compat.py”, line 35, in reraise
raise value
File “/home/Ai/env/lib/python3.5/site-packages/flask/app.py”, line 1813, in full_dispatch_request
rv = self.dispatch_request()
File “/home/Ai/env/lib/python3.5/site-packages/flask/app.py”, line 1799, in dispatch_request
return self.view_functionsrule.endpoint
File “./aiserver.py”, line 183, in medical_qa
anwser = chatbot_graph.ChatBotMedical(question)
File “./QAMedicalKG/chatbot_graph.py”, line 28, in ChatBotMedical
answer = handler.chat_main(question)
File “./QAMedicalKG/chatbot_graph.py”, line 18, in chat_main
final_answers = self.searcher.search_main(res_sql)
File “./QAMedicalKG/answer_search.py”, line 22, in search_main
ress = self.g.run(query).data()
File “/home/Ai/env/lib/python3.5/site-packages/py2neo/database.py”, line 498, in run
return self.begin(autocommit=True).run(cypher, parameters, **kwparameters)
File “/home/Ai/env/lib/python3.5/site-packages/py2neo/database.py”, line 858, in run
self.finish()
File “/home/Ai/env/lib/python3.5/site-packages/py2neo/database.py”, line 867, in finish
self.process()
File “/home/Ai/env/lib/python3.5/site-packages/py2neo/database.py”, line 864, in process
self.session.sync()
File “/home/Ai/env/lib/python3.5/site-packages/py2neo/internal/http.py”, line 313, in sync
response = self.post(ref, {“statements”: self._statements}, expected=(OK, CREATED))
File “/home/Ai/env/lib/python3.5/site-packages/py2neo/internal/http.py”, line 157, in post
rs = self.request(“POST”, self.path + ref, headers=self.headers, body=json)
File “/home/Ai/env/lib/python3.5/site-packages/py2neo/internal/http.py”, line 136, in request
raise ServiceUnavailable(“Cannot send %s request to <%s>” % (method, url))
neo4j.exceptions.ServiceUnavailable: Cannot send POST request to </db/data/transaction/commit>
原因:应该是neo4j挂掉了。
解决方法:进入到neo4j安装的所在目录,执行命令:./neo4j start