8
我都試過與pycassa
,cassandra.cluster
和dse.cluster
窗口集羣而不進行連接。連接蟒蛇卡桑德拉從DseAuthenticator和DseAuthorizer
我覺得我連接到錯誤的主機,因爲我正在編寫linux服務器主機名,而沒有指定任何關於cassandra的東西。
同事們告訴我他們只知道通過在linux機器上內嵌的cqlsh
連接到服務器。這聽起來很不起眼。
在cassandra.yaml
authenticator: com.datastax.bdp.cassandra.auth.DseAuthenticator
authorizer: com.datastax.bdp.cassandra.auth.DseAuthorizer
具體配置方面,我在pycassa做什麼:
import pycassa
URIPORTLIST = ['12345.mycompany.net:9420']
pool = pycassa.ConnectionPool('my_keyspace', server_list=URIPORTLIST,credentials={'USERNAME':'fancycar','PASSWORD':'becauseimbatman'}, prefill=False)
cf = pycassa.ColumnFamily(pool, 'my_table')
錯誤消息:
AllServersUnavailable: An attempt was made to connect to each of the servers twice, but none of the attempts succeeded. The last failure was TTransportException: Could not connect to 12345.mycompany.net:9420
隨着dse.cluster
from dse.cluster import Cluster
auth_provider = PlainTextAuthProvider(
username='fancycar', password='becauseimbatman')
cluster = Cluster(
['12345.mycompany.net'],
port=9042,auth_provider=auth_provider)
session = cluster.connect('my_keyspace')
錯誤消息:
NoHostAvailable: ('Unable to connect to any servers', {'11.111.11.1': AuthenticationFailed('Failed to authenticate to 11.111.11.2: Error from server: code=0100 [Bad credentials] message="Failed to login. Please re-try."',)})
嘗試使用相同的主機和憑證從cqlsh,看是否連接到卡桑德拉固定它作品...'cqlsh 12345.mycompany.net -u fancycar -p因爲緬甸人' –
@undefined_variable 感謝您的建議。 這給我一個錯誤: ''[[email protected] SYST:〜]#cqlsh 12345.mycompany.net -u fancycar -p因爲亞洲人' '連接錯誤:(('無法連接到任何服務器' {'11 .111.11.11' :誤差(無, 「嘗試連接到[('11 .111.11.11' ,9042)]上次錯誤:超時」)})' 而在 「如常」 作品記錄: '[[email protected] SYST:〜]#cqlsh -u fancycar -p becauseimbatman' '連接到12345_cluster在12345.mycompany.net:9042。 [cqlsh 5.0.1 | Cassandra 3.0.11.1485 | DSE 5.0.5 | CQL規範3.4.0 |本機協議v4]' – MadsVJ
您的第二個命令連接到本地主機,而首次連接到遠程服務器.. 12345.mycompany.net解析爲本地主機相同的主機? –