当前位置:   article > 正文

Clickhouse集群化(二)单节点部署

Clickhouse集群化(二)单节点部署

1. k8s单节点部署

  1. ---
  2. apiVersion: apps/v1
  3. kind: StatefulSet
  4. metadata:
  5. name: clickhouse
  6. labels:
  7. app: clickhouse
  8. spec:
  9. replicas: 1
  10. serviceName: clickhouse
  11. selector:
  12. matchLabels:
  13. app: clickhouse
  14. template:
  15. metadata:
  16. labels:
  17. app: clickhouse
  18. spec:
  19. containers:
  20. - name: clickhouse
  21. image: clickhouse-server:24.1.2.5
  22. imagePullPolicy: IfNotPresent
  23. env:
  24. ports:
  25. - containerPort: 8123
  26. protocol: TCP
  27. livenessProbe:
  28. httpGet:
  29. scheme: HTTP
  30. path: /ping
  31. port: 8123
  32. initialDelaySeconds: 600
  33. periodSeconds: 10
  34. timeoutSeconds: 10
  35. successThreshold: 1
  36. failureThreshold: 6
  37. affinity:
  38. nodeAffinity:
  39. requiredDuringSchedulingIgnoredDuringExecution:
  40. nodeSelectorTerms:
  41. - matchExpressions:
  42. - key: kubernetes.io/hostname
  43. operator: In
  44. values:
  45. - "node1"
  46. - "node2"
  47. podAntiAffinity:
  48. requiredDuringSchedulingIgnoredDuringExecution:
  49. - labelSelector:
  50. matchExpressions:
  51. - key: app
  52. operator: In
  53. values:
  54. - clickhouse
  55. topologyKey: "kubernetes.io/hostname"
  56. ---
  57. apiVersion: v1
  58. kind: Service
  59. metadata:
  60. labels:
  61. app: clickhouse
  62. name: clickhouse
  63. spec:
  64. ipFamilies:
  65. - IPv4
  66. - IPv6
  67. ipFamilyPolicy: PreferDualStack
  68. type: NodePort
  69. ports:
  70. - port: 8123
  71. protocol: TCP
  72. targetPort: 8123
  73. nodePort: 31120
  74. selector:
  75. app: clickhouse-v1

 clickhouse默认使用无密码的default用户 也可以根据环境变量进行修改

  1. apiVersion: v1
  2. kind: Secret
  3. metadata:
  4. name: clickhouse-secrets
  5. namespace: gzzx
  6. type: Opaque
  7. data:
  8. user: xxx # Base64 编码的用户
  9. password: xx # Base64 编码的密码
  1.           env:
  2.             - name: CLICKHOUSE_USER
  3.               valueFrom:
  4.                 secretKeyRef:
  5.                   name: clickhouse-secrets
  6.                   key: user
  7.             - name: CLICKHOUSE_PASSWORD
  8.               valueFrom:
  9.                 secretKeyRef:
  10.                   name: clickhouse-secrets
  11.                   key: password 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/1022532?site
推荐阅读
相关标签
  

闽ICP备14008679号