当前位置:首页 > Web开发 > 正文

just started 1 :C 22 Jan 2020 08 : 20 : 24.108 # Warning: n

2024-03-31 Web开发

[[email protected] guestbook]# cat redis-master-deployment.yaml apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 kind: Deployment metadata: name: redis-master labels: app: redis spec: selector: matchLabels: app: redis role: master tier: backend replicas: 1 template: metadata: labels: app: redis role: master tier: backend spec: containers: - name: master image: 192.168.9.14/public/redis # or just image: redis resources: requests: cpu: 100m memory: 100Mi ports: - containerPort: 6379 [[email protected] guestbook]# kubectl apply -f redis-master-deployment.yaml deployment.apps/redis-master created

检察

[[email protected] guestbook]# kubectl get pods NAME READY STATUS RESTARTS AGE kuard-5cd647675b-65cwg 1/1 Running 0 2d1h kuard-5cd647675b-65r9c 1/1 Running 0 2d1h kuard-5cd647675b-f9r9f 1/1 Running 0 2d1h nginx 1/1 Running 0 47h nginx-78b75497b7-rpt8t 1/1 Running 0 24h redis-master-79c5f44c84-5wq2n 1/1 Running 0 39s

运行以下命令检察 Redis 主节点 Pod 中的日志

[[email protected] guestbook]# kubectl logs -f redis-master-79c5f44c84-5wq2n 1:C 22 Jan 2020 08:20:24.108 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 1:C 22 Jan 2020 08:20:24.108 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=1, just started 1:C 22 Jan 2020 08:20:24.108 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 1:M 22 Jan 2020 08:20:24.110 * Running mode=standalone, port=6379. 1:M 22 Jan 2020 08:20:24.110 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 1:M 22 Jan 2020 08:20:24.110 # Server initialized 1:M 22 Jan 2020 08:20:24.110 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command echo never > /sys/kernel/mm/transparent_hugepage/enabled as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. 1:M 22 Jan 2020 08:20:24.111 * Ready to accept connections

创建 Redis 主节点的处事

[[email protected] guestbook]# ls redis-master-deployment.yaml redis-master-service.yaml [[email protected] guestbook]# cat redis-master-service.yaml apiVersion: v1 kind: Service metadata: name: redis-master labels: app: redis role: master tier: backend spec: ports: - port: 6379 targetPort: 6379 selector: app: redis role: master tier: backend

创建 Redis 主节点的处事

[[email protected] guestbook]# kubectl apply -f redis-master-service.yaml service/redis-master created [[email protected] guestbook]# kubectl get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kuard ClusterIP 10.110.133.234 <none> 80/TCP 2d2h kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 2d2h redis-master ClusterIP 10.102.97.125 <none> 6379/TCP 9s

启动 Redis 从节点

[[email protected] guestbook]# ls redis-master-deployment.yaml redis-master-service.yaml redis-slave-deployment.yaml [[email protected] guestbook]# cat redis-slave-deployment.yaml apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 kind: Deployment metadata: name: redis-slave labels: app: redis spec: selector: matchLabels: app: redis role: slave tier: backend replicas: 2 template: metadata: labels: app: redis role: slave tier: backend spec: containers: - name: slave image: registry.cn-hangzhou.aliyuncs.com/lina/gb-redisslave:v1 resources: requests: cpu: 100m memory: 100Mi env: - name: GET_HOSTS_FROM value: dns # Using `GET_HOSTS_FROM=dns` requires your cluster to # provide a dns service. As of Kubernetes 1.3, DNS is a built-in # service launched automatically. However, if the cluster you are using # does not have a built-in DNS service, you can instead # access an environment variable to find the master # services host. To do so, comment out the value: dns line above, and # uncomment the line below: # value: env ports: - containerPort: 6379

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/31104.html