You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: redis-cluster
namespace: default
spec:
# Specifies the cluster termination policy.
# - DoNotTerminate will block delete operation.
# - Halt will delete workload resources such as statefulset, deployment workloads but keep PVCs.
# - Delete is based on Halt and deletes PVCs.
# - WipeOut is based on Delete and wipe out all volume snapshots and snapshot data from backup storage location.
terminationPolicy: Delete
# List of ShardingSpecs used to define the components that make up a cluster.
# ComponentSpecs and ShardingSpecs cannot both be empty at the same time.
shardingSpecs:
# Specifies the identifier for the sharding configuration.
# This identifier is included as part of the Service DNS name and must comply with IANA Service Naming rules.
- name: shard
# Specifies the number of components, all of which will have identical specifications and definitions.
# The number of replicas for each component should be defined by template.replicas.
# The logical relationship between these components should be maintained by the components themselves
# The number of shards should be no less than 3
shards: 3
# The blueprint for the components. Generates a set of components (also referred to as shards) based on this template.
template:
# Specifies the name of the cluster's component.
name: redis
# References the name of the ComponentDefinition.
componentDef: redis-cluster
# The cluster-level configuration is used as the default configuration of all components;
# if the affinity and tolerations exists in a component, the component-level configuration
# will take effect and cover the default cluster-level configuration
affinity:
# Specifies the anti-affinity level of pods within a component.
# - Preferred
# - Required
podAntiAffinity: Preferred
# Represents the key of node labels.
topologyKeys:
- kubernetes.io/hostname
# Defines how pods are distributed across nodes.
tenancy: SharedNode
# Attached to tolerate any taint that matches the triple `key,value,effect` using the matching operator `operator`.
tolerations:
- key: kb-data
operator: Equal
value: "true"
effect: NoSchedule
# enable monitor of the component, default value is false if not claimed
monitor: false
# Indicates which log file takes effect
enabledLogs:
- running
# if not specified, will use the default service account created along with cluster
serviceAccountName: kb-redis-cluster
# Specifies the number of component replicas.
replicas: 1
# Defines the strategy for switchover and failover when workloadType is Replication.
switchPolicy:
# Type specifies the type of switch policy to be applied.
type: Noop
# Specifies the resources requests and limits of the workload.
resources:
limits:
cpu: "1"
memory: "1.1Gi"
requests:
cpu: "1"
memory: "1.1Gi"
# Specifies to use the NodePort, need to delete the serviceVersion and services specs if you want to use container network
serviceVersion: 7.0.6
services:
- name: redis-advertised
podService: true
#serverType
# - NodePort
# - LoadBalancer
serviceType: NodePort
# Provides information for statefulset.spec.volumeClaimTemplates.
volumeClaimTemplates:
# Refers to `clusterDefinition.spec.componentDefs.containers.volumeMounts.name`.
- name: data
spec:
# Contains the desired access modes the volume should have.
accessModes:
- ReadWriteOnce
# Represents the minimum resources the volume should have.
resources:
requests:
storage: 20Gi
Edit the yaml ,change replicas from 1 to 2, then kubectl apply -f cluster-shard.yaml
k get cluster
NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
redis-cluster Delete Running 21m
k get pod
NAME READY STATUS RESTARTS AGE
redis-cluster-shard-49r-0 3/3 Running 2 (9m33s ago) 12m
redis-cluster-shard-49r-1 3/3 Running 0 11m
redis-cluster-shard-sjh-0 3/3 Running 0 12m
redis-cluster-shard-sjh-1 3/3 Running 0 11m
redis-cluster-shard-wpv-0 3/3 Running 0 12m
redis-cluster-shard-wpv-1 3/3 Running 0 11m
2 new created pod cluster nodes info is not correct
# redis-cli -h 10.128.0.30 -p 31022 -a O3605v7HsS
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
10.128.0.30:31022> cluster nodes
f5cce503559018a68ffb8f29e2a1ad83f74e9690 10.128.0.30:31843@31771,redis-cluster-shard-sjh-1.redis-cluster-shard-sjh-headless.default.svc master - 0 1713521093000 0 connected
88780f6583930a9b4a6f74f1d07d1187af3e56a9 10.128.0.30:30924@31891,redis-cluster-shard-49r-0.redis-cluster-shard-49r-headless.default.svc master - 0 1713521094486 7 connected 6827-10922 15019-16383
9315a33085454e972d2dd489fffa31900d6a9f47 10.128.0.24:30628@31979,redis-cluster-shard-49r-1.redis-cluster-shard-49r-headless.default.svc master - 0 1713521093000 7 connected
8126a4ea2434ab9326e221a38b3e16e14d0dad86 10.128.0.30:31022@31002,redis-cluster-shard-wpv-1.redis-cluster-shard-wpv-headless.default.svc myself,slave 42357755c4a03bb37f759348dfdd132738b6a478 0 1713521091000 6 connected
bf35cb9cdaa340a18f19fa2fc420370b1827ad07 10.128.0.28:30301@32062,redis-cluster-shard-sjh-0.redis-cluster-shard-sjh-headless.default.svc master - 0 1713521092576 5 connected 1365-5460 12288-13653
42357755c4a03bb37f759348dfdd132738b6a478 10.128.0.28:32745@32317,redis-cluster-shard-wpv-0.redis-cluster-shard-wpv-headless.default.svc master - 0 1713521093481 6 connected 0-1364 5461-6826 10923-12287 13654-15018
# redis-cli -h 10.128.0.24 -p 30628 -a O3605v7HsS
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
10.128.0.24:30628> cluster nodes
9315a33085454e972d2dd489fffa31900d6a9f47 10.128.0.24:30628@31979,redis-cluster-shard-49r-1.redis-cluster-shard-49r-headless.default.svc myself,master - 0 1713520872839 0 connected
10.128.0.24:30628> exit
# redis-cli -h 10.128.0.30 -p 31843 -a O3605v7HsS
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
10.128.0.30:31843> cluster nodes
f5cce503559018a68ffb8f29e2a1ad83f74e9690 10.128.0.24:31843@31771,redis-cluster-shard-sjh-1.redis-cluster-shard-sjh-headless.default.svc myself,master - 0 1713520894969 0 connected
kbcli version
Kubernetes: v1.28.7-gke.1026000
KubeBlocks: 0.9.0-beta.10
kbcli: 0.9.0-beta.1
2 new created pod cluster nodes info is not correct
The text was updated successfully, but these errors were encountered: