c# - 无法使用 c# 客户端连接 docker aerospike 服务器
问题描述
我是 aerospike 的新手。我已经使用 Docker 部署了 aerospike。下面是我用来部署 Aerospike 服务器的命令。
docker run -d --name aerospike1 -p 3000:3000 aerospike/aerospike-server
码头工人ps输出:
容器 ID 图像命令创建状态端口名称 1376791119a2 aerospike/aerospike-server "/entrypoint.sh asd" 13 分钟前 上升 13 分钟 0.0.0.0:3000->3000/tcp, 3001-3003/tcp aerospike1
但是,在连接时出现连接错误。
错误 :
错误-8:无法连接到主机:localhost 3000 错误-8:连接尝试失败,因为连接方在一段时间后没有正确响应,或建立连接失败,因为连接的主机没有响应
下面是我的代码
// Establish connection the server
AerospikeClient client = new AerospikeClient("localhost",3000);
// Create key
Key key = new Key("test", "credits", "123425");
//Key key = new Key("test", "foo", "123");
// Create Bins
Bin bin1 = new Bin("name", "Sam");
Bin bin2 = new Bin("age", 25);
Bin bin3 = new Bin("gender", "Male");
Bin bin4 = new Bin("department", "Engineering");
// Write record
client.Put(null, key, bin1, bin2, bin3, bin4);
// Read record
Record record = client.Get(null, key);
string s = record.GetGeoJSON("");
// Close connection
client.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
解决方案
推荐阅读
- asp.net-mvc - 复杂角色授权 Asp.net core MVC
- intellij-idea - Intellij 支持 UML 活动图
- java - 为什么使用此 WSDL 时我的 SOAP 请求总是空的?
- eclipse - 如何在调试期间在 FreeRTOS 任务列表中显示运行时
- javascript - 数字为 0 的 Ajax 响应被解析为未定义
- c# - XSD 验证错误 - 缺少有关 xsd 架构错误代码的详细信息
- python - 查找每类 TF-IDF 得分最高的前 n 个术语
- android - 获取,失败 [INSTALL_FAILED_OLDER_SDK:installPackageLI 期间解析失败
- java - Javafx 无法加载新添加的图像
- php - 如何使用 ajax 将 json 数据发送到 php 文件