저는이 작은 대학 프로젝트를 가지고 있으며 Bokeh 프론트 엔드와 Cassandra 백엔드가있는 간단한 파이썬 응용 프로그램을 개발했습니다. 프로토 타입을 작성하고 단일 카산드라 노드로 개발 한 다음 기본 노드 하나, 가상 노드 두 개까지 세 노드까지 확장했습니다.DataStax Python Cassandra 드라이버가 로컬 호스트의 Cassandra를 잘못 찾습니다.
- 192.168.56.1 노예 마스터
- 192.168.56.101/102을 위해 : 따라서 개발은 내가 IP 주소를 vboxnet0라는 이름의 호스트 전용 네트워크를 사용하여 마이그레이션, 로컬 호스트에 있었다. :
카산드라 버전 3.11.1이
보케 서버 버전 나는 그에 따라 코드를 변경
(토네이도 4.4.3에서 실행) 0.12.10 그래서 내 응용 프로그램 코드로 시작이다
[email protected]:~> cqlsh
Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})
,536,913,632 :
from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider
from cassandra.query import dict_factory`
def pandas_factory(colnames, rows):
return pd.DataFrame(rows, columns=colnames)
auth_provider = PlainTextAuthProvider(username='', password='')
cluster = Cluster(contact_points=['192.168.56.1'], port=9042, auth_provider=auth_provider)
session = cluster.connect()
session.row_factory = pandas_factory
session.default_fetch_size = None
카산드라는 로컬 호스트에서 실행 하지입니다 10
그리고 아직 파이썬 드라이버는 어떻게 든 127.0.0.1에 카산드라 호스트를 발견 생각과 연결을 시도 :
[email protected]:~/Folder/subfolder> bokeh serve Appname > ~/bokeh.output
2017-11-22 19:24:49,230 Starting Bokeh server version 0.12.10 (running on Tornado 4.4.3)
2017-11-22 19:24:49,233 Bokeh app running at: http://localhost:5006/Appname
2017-11-22 19:24:49,233 Starting Bokeh server with process id: 5819
2017-11-22 19:25:03,281 Using datacenter 'datacenter1' for DCAwareRoundRobinPolicy (via host '192.168.56.1'); if incorrect, please specify a local_dc to the constructor, or limit contact points to local cluster nodes
2017-11-22 19:25:03,281 New Cassandra host <Host: 127.0.0.1 datacenter1> discovered
2017-11-22 19:25:03,282 Found multiple hosts with the same rpc_address (127.0.0.1). Excluding peer 192.168.56.101
2017-11-22 19:25:03,368 Failed to create connection pool for new host 127.0.0.1:
Traceback (most recent call last):
File "cassandra/cluster.py", line 2343, in cassandra.cluster.Session.add_or_renew_pool.run_add_or_renew_pool (cassandra/cluster.c:44919)
File "cassandra/pool.py", line 332, in cassandra.pool.HostConnection.__init__ (cassandra/pool.c:6757)
File "cassandra/cluster.py", line 1119, in cassandra.cluster.Cluster.connection_factory (cassandra/cluster.c:16094)
File "cassandra/connection.py", line 330, in cassandra.connection.Connection.factory (cassandra/connection.c:5963)
File "/usr/lib64/python3.6/site-packages/cassandra/io/asyncorereactor.py", line 307, in __init__
self._connect_socket()
File "cassandra/connection.py", line 369, in cassandra.connection.Connection._connect_socket (cassandra/connection.c:7477)
ConnectionRefusedError: [Errno 111] Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused
2017-11-22 19:25:03,403 Host 127.0.0.1 has been marked down
2017-11-22 19:25:04,406 Error attempting to reconnect to 127.0.0.1, scheduling retry in 2.0 seconds: [Errno 111] Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused
2017-11-22 19:25:06,414 Error attempting to reconnect to 127.0.0.1, scheduling retry in 4.0 seconds: [Errno 111] Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused
2017-11-22 19:28:14,994 Error attempting to reconnect to 127.0.0.1, scheduling retry in 8.0 seconds: [Errno 111] Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused
2017-11-22 19:28:16,489 Host 127.0.0.1 may be up; will prepare queries and open connection pool
2017-11-22 19:28:16,808 Failed to create connection pool for new host 127.0.0.1:
을 그리고 그것은 계속적으로 간다. 앞면에서는 정상적으로 보입니다. 앱이 작동하고 192.168.56.1이 올바르게 쿼리되지만, 이는 옳지 않은 것이 짜증나며 버그인지 내 자신의 잘못인지는 알 수 없습니다.