我正在尝试使用 github 操作在测试容器上运行 aerospike,
当我在 github 操作上运行此操作时,我有时会收到错误,有时则不会,我收到的错误如下,
integration_test.go:124: error getting aerospike client: error creating cluster client: aero client failed to connect to [127.0.0.1]:32772 timeout:10s: ResultCode: INVALID_NODE_ERROR, Iteration: 0, InDoubt: false, Node: <nil>: Failed to connect to hosts: [127.0.0.1:32772]
我的 Aerospike 配置如下,
service {
user root
group root
# Number of nodes where the replica count is automatically reduced to 1.
# paxos-single-replica-limit 1
# pidfile /var/run/aerospike/asd.pid
proto-fd-max 15000
query-threads-limit 100
}
logging {
# Log file must be an absolute path.
file ${LOGFILE} {
context any critical
}
# Send log messages to stdout
console {
context any info
}
}
network {
service {
address any
port 3000
# Uncomment the following to set the `access-address` parameter to the
# IP address of the Docker host. This will the allow the server to correctly
# publish the address which applications and other nodes in the cluster to
# use when addressing this node.
# access-address <IPADDR>
}
heartbeat {
address any
# mesh is used for environments that do not support multicast
mode mesh
port 3002
# use asinfo -v 'tip:host=<ADDR>;port=3002' to inform cluster of
# other mesh nodes
interval 150
timeout 10
}
fabric {
address any
port 3001
}
}
namespace persistent00 {
replication-factor 1
memory-size 20M
storage-engine memory
nsup-period 86400
}
这就是我通过使用测试容器进行连接的方式,
func startContainer(ctx context.Context) (*aerospikeContainer, error) {
req := testcontainers.ContainerRequest{
Image: "aerospike/aerospike-server:6.2.0.12",
ExposedPorts: []string{"3000/tcp", "3001/tcp", "3002/tcp"},
Files: []testcontainers.ContainerFile{
{
HostFilePath: "aerospike.conf",
ContainerFilePath: "aerospike.conf",
},
},
Cmd: []string{"--config-file", "aerospike.conf"},
WaitingFor: wait.ForAll(
wait.ForListeningPort("3000/tcp"),
wait.ForLog("{persistent00} migrations: complete").WithOccurrence(2),
),
}
container, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: req,
Started: true,
})
if err != nil {
return nil, err
}
return &aerospikeContainer{Container: container}, nil
}
我应该怎么做才能让它发挥作用?
我尝试使用心跳并增加
withOccurence
但似乎仍然不起作用