发布于 2022-07-26 13:07:01
不能用环境变量声明多个命名空间。但是你可以传递自定义的飞机配置文件。请看下面的示例:
static final GenericContainer<?> aerospike =
new GenericContainer<>(DockerImageName.parse("aerospike/aerospike-server:5.6.0.4"))
.withClasspathResourceMapping("aerospike.conf", "/opt/aerospike/etc/aerospike.conf", READ_ONLY)
.withExposedPorts(3000, 3001, 3002)
.withCommand("--config-file /opt/aerospike/etc/aerospike.conf")
.waitingFor(Wait.forLogMessage(".*migrations: complete.*", 2));withClasspathResourceMapping方法将aerospike.conf文件复制到容器中。该文件放置在src/test/resources目录中。这里是一个带有两个名称空间的Aerospike配置示例。
# This stanza must come first.
service {
user root
group root
paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
pidfile /var/run/aerospike/asd.pid
proto-fd-max 15000
}
logging {
# Log file must be an absolute path.
file /dev/null {
context any info
}
# Send log messages to stdout
console {
context any info
}
}
network {
service {
address any
port 3000
}
heartbeat {
address any
mode mesh
port 3002
interval 150
timeout 10
}
fabric {
address any
port 3001
}
}
namespace product-namespace {
replication-factor 1
memory-size 1G
default-ttl 30d
nsup-period 120
storage-engine device {
file /opt/aerospike/data/product_namespace.dat
filesize 4G
data-in-memory true # Store data in memory in addition to file.
}
}
namespace client-namespace {
replication-factor 1
memory-size 1G
default-ttl 30d
nsup-period 120
storage-engine device {
file /opt/aerospike/data/client_namespace.dat
filesize 4G
data-in-memory true # Store data in memory in addition to file.
}
}在本例中,将创建product-namespace和client-namespace。
https://stackoverflow.com/questions/73122194
复制相似问题