我在VM中初始化了Riak,我希望在Python控制台上使用它。
Riak端口:8098,VM主机:192.168.78.128
Windows:
from riak import RiakClient, RiakNode
client = RiakClient(protocol='http', host='192.168.78.128', http_port=8098)
bucket = client.bucket_type('visitors').bucket('hits')
bucket.new("one", data={'value':'one'}, content_type="application/json").store()
输出:
Traceback (most recent call last):
File "G:/untitled3/riak_.py", line 13, in <module>
content_type="application/json").store()
File "build\bdist.win32\egg\riak\bucket.py", line 178, in new
File "build\bdist.win32\egg\riak\util.py", line 98, in __get__
File "build\bdist.win32\egg\riak\bucket.py", line 743, in datatype
File "build\bdist.win32\egg\riak\bucket.py", line 675, in get_properties
File "build\bdist.win32\egg\riak\client\transport.py", line 223, in wrapper
File "build\bdist.win32\egg\riak\client\transport.py", line 150, in _with_retries
File "C:\Python27\lib\contextlib.py", line 17, in __enter__
return self.gen.next()
File "build\bdist.win32\egg\riak\transports\pool.py", line 181, in transaction
File "build\bdist.win32\egg\riak\transports\pool.py", line 143, in acquire
File "build\bdist.win32\egg\riak\transports\http\__init__.py", line 155, in create_resource
File "build\bdist.win32\egg\riak\transports\http\transport.py", line 52, in __init__
File "build\bdist.win32\egg\riak\transports\http\connection.py", line 72, in _connect
File "build\bdist.win32\egg\riak\util.py", line 98, in __get__
File "build\bdist.win32\egg\riak\transports\feature_detect.py", line 197, in server_version
File "build\bdist.win32\egg\riak\transports\http\transport.py", line 74, in _server_version
File "build\bdist.win32\egg\riak\transports\http\transport.py", line 65, in stats
File "build\bdist.win32\egg\riak\transports\http\resources.py", line 23, in stats_path
File "build\bdist.win32\egg\riak\util.py", line 98, in __get__
File "build\bdist.win32\egg\riak\transports\http\resources.py", line 222, in riak_kv_wm_stats
File "build\bdist.win32\egg\riak\util.py", line 98, in __get__
File "build\bdist.win32\egg\riak\transports\http\resources.py", line 258, in resources
File "build\bdist.win32\egg\riak\transports\http\transport.py", line 95, in get_resources
File "build\bdist.win32\egg\riak\transports\http\connection.py", line 33, in _request
File "C:\Python27\lib\httplib.py", line 1001, in request
self._send_request(method, url, body, headers)
File "C:\Python27\lib\httplib.py", line 1035, in _send_request
self.endheaders(body)
File "C:\Python27\lib\httplib.py", line 997, in endheaders
self._send_output(message_body)
File "C:\Python27\lib\httplib.py", line 850, in _send_output
self.send(msg)
File "C:\Python27\lib\httplib.py", line 812, in send
self.connect()
File "build\bdist.win32\egg\riak\transports\http\__init__.py", line 42, in connect
File "C:\Python27\lib\httplib.py", line 793, in connect
self.timeout, self.source_address)
File "C:\Python27\lib\socket.py", line 571, in create_connection
raise err
socket.error: [Errno 10060] A connection attempt failed because the
connected party did not properly respond after a period of time, or established
connection failed because connected host has failed to respond