在 Linux 拉起来一个最小的 eru 单点集群.
单节点就行了, 用容器跑起来超简单.
docker run -d --net host --name etcd --restart always quay.io/coreos/etcd:v3.4.9 /usr/local/bin/etcd --enable-v2 --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://etcd:2379
mkdir -p /etc/eru
cat <<! > /etc/eru/core.yaml
log_level: "DEBUG"
bind: ":5001"
service_address: 127.0.0.1:5001
statsd: "127.0.0.1:8125"
profile: ":12346"
global_timeout: 300s
lock_timeout: 30s
cert_path: "/tmp"
max_concurrency: 20
grpc:
max_concurrent_streams: 100
etcd:
machines:
- "http://localhost:2379"
prefix: "/eru"
lock_prefix: "core/_lock"
docker:
log:
type: "json-file"
config:
"max-size": "10m"
network_mode: "bridge"
hub: "hub.docker.com"
namespace: "projecteru2"
build_pod: "local"
local_dns: true
scheduler:
maxshare: -1
sharebase: 100
!
docker run -d --name eru-core --restart always -v /etc/eru:/etc/eru -v /root/.ssh:/root/.ssh --net host projecteru2/core eru-core
alias eru-cli='docker run -it -v $(pwd):/src -w /src --net host projecteru2/cli eru-cli'
echo alias eru-cli=\'docker run -it -v $(pwd):/src -w /src --net host projecteru2/cli eru-cli\' >> ~/.bashrc
┌──────┬─────────────┐
│ NAME │ DESCRIPTION │
├──────┼─────────────┤
└──────┴─────────────┘
sed -i 's!ExecStart=.*!\0 -H tcp://0.0.0.0:2376!' /lib/systemd/system/docker.service
systemctl daemon-reload && systemctl restart docker
eru-cli pod add testpod
eru-cli node add --nodename node1 --endpoint tcp://127.0.0.1:2376 testpod
root@localhost:~# eru-cli pod add testpod
┌─────────┬─────────────┐
│ NAME │ DESCRIPTION │
├─────────┼─────────────┤
│ testpod │ │
└─────────┴─────────────┘
root@localhost:~# eru-cli node add --nodename node1 --endpoint tcp://127.0.0.1:2376 testpod
┌───────┬──────────────────────┬──────────┬──────────────────────┬─────────────┬─────────────┐
│ NAME │ ENDPOINT │ CPU │ MEMORY │ VOLUME │ STORAGE │
├───────┼──────────────────────┼──────────┼──────────────────────┼─────────────┼─────────────┤
│ node1 │ tcp://127.0.0.1:2376 │ 0.00 / 4 │ 0 / 6261624012 bytes │ 0 / 0 bytes │ 0 / 0 bytes │
└───────┴──────────────────────┴──────────┴──────────────────────┴─────────────┴─────────────┘
接下来我们可以开始创建应用了.