我想在 4 個本地服務器上使用 golang aerospike,我可以使用這樣的 PHP 代碼連接它#CONFIG FOR AEROSPIKE CONNECTION $CONF['aerospike_server'] = array( 'hosts' => array( array( 'addr' => '192.168.7.241', 'port' => 3000 ), array( 'addr' => '192.168.7.243', 'port' => 3000 ), array( 'addr' => '192.168.7.244', 'port' => 3000 ), array( 'addr' => '192.168.7.245', 'port' => 3000 ) ) );$aeroDB = new Aerospike($CONF['aerospike_server']);我如何使用 golang 執行此操作?我正在使用這個https://github.com/aerospike/aerospike-client-go 我也在參考中讀到確實有 NewClientWithPolicyAndHost 和 NewHosts 但找不到示例或如何使用它。我正在使用 go 版本 go1.17 linux/amd64
1 回答
慕容森
TA貢獻1853條經驗 獲得超18個贊
假設我正確理解了問題,我確實設法獲得了一些意見:
client, err := aero.NewClientWithPolicyAndHost(aero.NewClientPolicy(), aero.NewHost(ip1, port1), aero.NewHost(ip2, port2), aero.NewHost(ip3, port3), aero.NewHost(ip4, port4))
if err != nil {
log.Fatal(err)
}
- 1 回答
- 0 關注
- 97 瀏覽
添加回答
舉報
0/150
提交
取消
