debian怎么配置静态ip地址
277
2022-09-12
k8s redis-cluster 6节点(3主3从)
此创建仅为简单创建,无PV、PVC挂载一、 把redis.conf配置文件引入configmapcat redis.confappendonly yes cluster-enabled yes cluster-config-file /var/lib/redis/nodes.conf cluster-node-timeout 5000 dir /var/lib/redis port 6379kubectl create configmap redis-conf --from-file=redis.conf二、 创建HeadlessServiceapiVersion: v1 kind: Service metadata: name: redis-service labels: app: redis spec: ports: - name: redis-port port: 6379 clusterIP: None selector: app: redis appCluster: redis-cluster三、 创建statefulset## 如果看到 apps/v1beta1 不要惊讶,方法附在apiVersion: apps/v1 kind: StatefulSet metadata: name: redis-app spec: serviceName: "redis-service" replicas: 6 selector: matchLabels: app: redis appCluster: redis-cluster template: metadata: labels: app: redis appCluster: redis-cluster spec: terminationGracePeriodSeconds: 20 affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchExpressions: - key: app operator: In values: - redis topologyKey: kubernetes.io/hostname containers: - name: redis image: "registry.cn-qingdao.aliyuncs.com/gold-faas/gold-redis:1.0" command: - "redis-server" args: - "/etc/redis/redis.conf" - "--protected-mode" - "no" resources: requests: cpu: "100m" memory: "100Mi" ports: - name: redis containerPort: 6379 protocol: "TCP" - name: cluster containerPort: 16379 protocol: "TCP" volumeMounts: - name: "redis-conf" mountPath: "/etc/redis" - name: "redis-data" mountPath: "/var/lib/redis" volumes: - name: "redis-conf" configMap: name: "redis-conf" items: - key: "redis.conf" path: "redis.conf" - name: "redis-data" emptyDir: {}四、service创建,跨ns访问apiVersion: v1 kind: Service metadata: name: gold-redis labels: app: redis spec: ports: - name: redis-port protocol: "TCP" port: 6379 targetPort: 6379 selector: app: redis appCluster: redis-cluster五、 开始 初始化redis集群kubectl run -i --tty redis-cluster-manager --image=ubuntu --restart=Never /bin/bash## 进入容器操作如下(此操作,由本人实测) 2 apt update 3 apt install wget dnsutils # 这里make的时候可能会出来时区选择,我这里先选择的是 Asia (亚洲), 后选择的Shanghai(上海) 4 wget 5 tar -xzf redis-5.0.3.tar.gz 6 cd redis-5.0.3 9 apt install -y make gcc 13 apt install -y gcc-c++ # 可能会报错,不装了,忽略 15 make MALLOC=libc # 直接make,如果不行,使用这条 # 这里报错如下,所以添加参数 MALLOC=libc In file included from adlist.c:34: zmalloc.h:50:10: fatal error: jemalloc/jemalloc.h: No such file or directory 50 | #include
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~