无法在python中使用DynamoDB设置DAX

时间:2017-08-10 14:21:58

标签: python-3.x boto3 amazon-dynamodb-dax

我设置了一个似乎有效的DAX集群。我可以使用telnet连接到它。

这是我使用DynamoDB的脚本的一部分

dynamodb = boto3.resource('dynamodb', region_name='us-east-1')

但我只添加了DAX端点

dynamodb = boto3.resource('dynamodb', region_name='us-east-1', 
               endpoint_url='dax-test.awj2jy.clustercfg.dax.use1.cache.amazonaws.com:8111'
                      )

脚本失败

Traceback (most recent call last): File "get.py", line 25, in <module> endpoint_url='dax-test.awj2jy.clustercfg.dax.use1.cache.amazonaws.com:8111' File "/home/ubuntu/dax/lib/python3.5/site-packages/boto3/__init__.py", line 92, in resource return _get_default_session().resource(*args, **kwargs) File "/home/ubuntu/dax/lib/python3.5/site-packages/boto3/session.py", line 389, in resource aws_session_token=aws_session_token, config=config) File "/home/ubuntu/dax/lib/python3.5/site-packages/boto3/session.py", line 263, in client aws_session_token=aws_session_token, config=config) File "/home/ubuntu/dax/lib/python3.5/site-packages/botocore/session.py", line 836, in create_client client_config=config, api_version=api_version) File "/home/ubuntu/dax/lib/python3.5/site-packages/botocore/client.py", line 71, in create_client verify, credentials, scoped_config, client_config, endpoint_bridge) File "/home/ubuntu/dax/lib/python3.5/site-packages/botocore/client.py", line 281, in _get_client_args verify, credentials, scoped_config, client_config, endpoint_bridge) File "/home/ubuntu/dax/lib/python3.5/site-packages/botocore/args.py", line 79, in get_client_args timeout=(new_config.connect_timeout, new_config.read_timeout)) File "/home/ubuntu/dax/lib/python3.5/site-packages/botocore/endpoint.py", line 273, in create_endpoint raise ValueError("Invalid endpoint: %s" % endpoint_url) ValueError: Invalid endpoint: dax-test.awj2jy.clustercfg.dax.use1.cache.amazonaws.com:8111

还有什么我应该做的吗? 我正在使用boto3 v1.4.5

1 个答案:

答案 0 :(得分:6)

DAX有线协议与基于HTTP的DynamoDB协议不兼容。 DAX目前有一个SDK for Java。正在积极开发其他语言的SDK。有关如何使用Java SDK for DAX的更多信息,请参阅user guide

虽然您可以使用boto3配置DAX群集。您还无法使用Python连接到群集。