美文网首页
每周阅读(1/28/2019)

每周阅读(1/28/2019)

作者: Jeff | 来源:发表于2019-02-03 14:24 被阅读6次

etcd 文章:第一篇入门,第二篇如标题所言对于应用场景和实现原理做了全方位解读。

对于 IBM ICP,etcd 配置位于:/etc/cfc/pods/etcd.json,默认 wal 文件数目没有限制(设置为 0),可以参照如下步骤修改,不然磁盘会被撑爆。

// /etc/cfc/pods# cat etcd.json
{
    "apiVersion": "v1",
    "kind": "Pod",
    "metadata": {
        "name": "k8s-etcd",
        "namespace": "kube-system",
        "annotations": {
            "scheduler.alpha.kubernetes.io/critical-pod": ""
        }
    },
    "spec": {
        "containers": [
            {
                "command": [
                    "etcd",
                    "--name=etcd0",
                    "--data-dir=/var/lib/etcd",
                    "--wal-dir=/var/lib/etcd-wal/wal",
                    "--max-wals=5",
                    "--initial-advertise-peer-urls=https://9.30.215.12:2380",
                    "--listen-peer-urls=https://0.0.0.0:2380",
                    "--listen-client-urls=https://0.0.0.0:4001",
                    "--advertise-client-urls=https://9.30.215.12:4001",
                    "--cert-file=/etc/cfc/conf/etcd/server.pem",
                    "--key-file=/etc/cfc/conf/etcd/server-key.pem",
                    "--client-cert-auth",
                    "--trusted-ca-file=/etc/cfc/conf/etcd/ca.pem",
                    "--initial-cluster-token=etcd-cluster-1",
                    "--initial-cluster=etcd0=https://9.30.215.12:2380",
                    "--peer-cert-file=/etc/cfc/conf/etcd/member-9.30.215.12.pem",
                    "--peer-key-file=/etc/cfc/conf/etcd/member-9.30.215.12-key.pem",
                    "--peer-trusted-ca-file=/etc/cfc/conf/etcd/ca.pem",
                    "--peer-client-cert-auth=true",
                    "--peer-auto-tls=false",
                    "--grpc-keepalive-timeout=0",
                    "--grpc-keepalive-interval=0",
                    "--snapshot-count=10000",
                    "--initial-cluster-state=new"
                ],
                "image": "mycluster.icp:8500/ibmcom/etcd:v3.2.18",
                "securityContext": {
                    "privileged": true
                },
                "imagePullPolicy": "IfNotPresent",
                "name": "etcd",
                "volumeMounts": [
                    {
                        "mountPath": "/var/lib/etcd",
                        "name": "data"
                    },
                    {
                        "mountPath": "/var/lib/etcd-wal",
                        "name": "wal"
                    },
                    {
                        "mountPath": "/etc/cfc/conf/etcd",
                        "name": "etcd-certs"
                    }
                ]
            }
        ],
        "hostNetwork": true,
        "volumes": [
            {
                "hostPath": {
                    "path": "/var/lib/etcd"
                },
                "name": "data"
            },
            {
                "hostPath": {
                    "path": "/var/lib/etcd-wal"
                },
                "name": "wal"
            },
            {
                "hostPath": {
                    "path": "/etc/cfc/conf/etcd"
                },
                "name": "etcd-certs"
            }
        ]
    }
}
- 停止 etcd: mv /etc/cfc/pods/etcd.json /etc/cfc/etcd.json 
- 查看 etcd 是否已经停止:docker ps | grep etcd
- 修改:vi /etc/cfc/etcd.json, max-wals=0 -> max-wals=5
- 启动 etcd: mv /etc/cfc/etcd.json /etc/cfc/pods/etcd.json,如果发现 etcd 没有启动,可以用 systemctl restart docker 来重启 docker 容器

如果要使用 etcdctl,可以从 etcd 容器复制它:

docker cp dc23e35c7fc6:/usr/local/bin/etcdctl /usr/local/bin/

ETCDCTL_API=3 /usr/local/bin/etcdctl --endpoints=9.30.215.12:4001 --cert /etc/cfc/conf/etcd/client.pem --key /etc/cfc/conf/etcd/client-key.pem --cacert /etc/cfc/conf/etcd/ca.pem endpoint health

ICP 上 etcd 是容器化提供,所以可以通过 docker logs -f xxxx-container-id 查看 etcd 日志。

相关文章

  • 每周阅读(1/28/2019)

    etcd 文章:第一篇入门,第二篇如标题所言对于应用场景和实现原理做了全方位解读。 etcd 使用入门 etcd:...

  • 每周阅读(1/21/2019)

    忙于出差和项目,时间比较零碎,缺少时间输出更多的东西,但是学习不会拉下,目前主要从事的是私有云相关工作,和 Kub...

  • 每周阅读1

  • 2019年读书计划

    1、《只有医生知道》2019年9月18日完成阅读 2、《人生海海》2019年8月28日完成阅读 3、《精进:如何成...

  • 2019-06-28

    2019-06-28 hollow_6b31 字数 22 · 阅读 0 2019-06-28 22:30 凡事可以...

  • 每周阅读(5/28/2018)

    最近忙,少有时间关注其他,人到中年还是目前这么个状态,值得反思,得让自己慢下来。 上周末和家人及好友走了趟无锡军嶂...

  • 每周阅读(11/28/2016)

    推荐2个reading list,第一个设计CS的方方面面,第二个是关于DevOps。Essential Prog...

  • 每周阅读(08/28/2017)

    UTMB 2017: so close to the start, how did I even get here...

  • 每周阅读(12/28/2016)

    2017年元旦,假期难得的悠闲,简单记录最近的阅读和一些思考印记。 7 Ways to Use the Rule ...

  • 2019-11-25

    #60天精进读书计划*day28# 2019年11月25日 【阅读书籍名称】 《游戏力》 【阅读页码】1-20 【...

网友评论

      本文标题:每周阅读(1/28/2019)

      本文链接:https://www.haomeiwen.com/subject/ekrssqtx.html