从本地主机客户端访问 DAX AWS 时出错

错误:

EVERE:在集群刷新期间捕获异常:java.io.IOException:无法从主机配置集群端点:[daxcluster*:8111]
java.io.IOException:无法从主机配置集群端点:

示例测试代码

public static String clientEndPoint = "*.amazonaws.com:8111";

DynamoDB getDynamoDBClient() {
    System.out.println("Creating a DynamoDB client");
    AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard().withRegion(Regions.US_EAST_1).build();
    return new DynamoDB(client);
}
static DynamoDB getDaxClient(String daxEndpoint) {
    ClientConfig daxConfig = new ClientConfig().withEndpoints(daxEndpoint);
    daxConfig.setRegion(Regions.US_EAST_1.getName());
    AmazonDaxClient client = new ClusterDaxClient(daxConfig);
    DynamoDB docClient = new DynamoDB(client);
    return docClient;
}

public static void main(String args[]) {

    DynamoDB client = getDaxClient(clientEndPoint);
    Table table = client.getTable("dev.Users");
    Item fa = table.getItem(new GetItemSpec().withPrimaryKey("userid", "[email protected]"));
    System.out.println(fa);

}

最佳答案

DAX 集群在您的 VPC 中运行。要从您的笔记本电脑连接到 DAX 集群,您需要通过 VPN 连接到您的 VPC:http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpn-connections.html

关于amazon-web-services - 从本地主机客户端访问 DAX aws 时出错,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45143165/

10-13 00:33