跳到主要内容

2 篇博文 含有标签「k8s」

查看所有标签

· 阅读需 2 分钟
Vinloong
redis-ha-haproxy.redis-ha.svc
redis-sentinel.redis-ha.svc
redis-cluster.redis-ha.svc
helm fetch bitnami/redis --untar [--untardir ./]
helm install redis-sentinel . -n redis-ha

Redis can be accessed via port 6379 and Sentinel can be accessed via port 26379 on the following DNS name from within your cluster: redis-ha.redis-ha.svc.cluster.local

To connect to your Redis server:

  1. To retrieve the redis password:
   echo $(kubectl get secret redis-ha -o "jsonpath={.data['auth']}" | base64 --decode)
  1. Connect to the Redis master pod that you can use as a client. By default the redis-ha-server-0 pod is configured as the master:
   kubectl exec -it redis-ha-server-0 sh -n redis-ha
  1. Connect using the Redis CLI (inside container):
   redis-cli -a <REDIS-PASS-FROM-SECRET>

Please be patient while the chart is being deployed

Redis® can be accessed via port 6379 on the following DNS name from within your cluster:

`redis-sentinel.redis-ha.svc.cluster.local` for read only operations

For read/write operations, first access the Redis® Sentinel cluster, which is available in port 26379 using the same domain name above.

To get your password run:

    export REDIS_PASSWORD=$(kubectl get secret --namespace redis-ha redis-ha-passwd -o jsonpath="{.data.redis-password}" | base64 -d)

To connect to your Redis® server:

  1. Run a Redis® pod that you can use as a client:
   kubectl run --namespace redis-ha redis-client --restart='Never'  --env REDIS_PASSWORD=$REDIS_PASSWORD  --image docker.io/bitnami/redis:7.0.7-debian-11-r9 --command -- sleep infinity

Use the following command to attach to the pod:

kubectl exec --tty -i redis-client \
--namespace redis-ha -- bash
  1. Connect using the Redis® CLI:
   REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis-sentinel -p 6379 # Read only operations
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis-sentinel -p 26379 # Sentinel access

To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace redis-ha svc/redis-sentinel 6379:6379 &
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h 127.0.0.1 -p 6379

· 阅读需 2 分钟
Vinloong
wget https://github.91chi.fun/https://github.com/labring/sealos/releases/download/v4.1.3/sealos_4.1.3_linux_amd64.tar.gz
tar -zxvf sealos_4.1.3_linux_amd64.tar.gz sealos
chmod +x sealos
mv sealos /usr/bin
sealos version
sealos apply -f Clusterfile

sealos reset --cluster fs-cloud --masters 10.8.40.125,10.8.40.126,10.8.40.129 --nodes 10.8.40.134,10.8.40.133,10.8.40.128,10.8.40.124 -p Freesun_123

sealos --cluster fs-cloud add --nodes 10.8.40.124


mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl exec -it -n rook-ceph rook-ceph-tools-5679b7d8f-8fpqj -- bash
$ ceph status
cluster:
id: b3282dee-82f6-4e2f-b89e-48c01077662b
health: HEALTH_OK

services:
mon: 3 daemons, quorum a,b,d (age 31s)
mgr: b(active, since 76s), standbys: a
osd: 3 osds: 3 up (since 76s), 3 in (since 103s)

data:
pools: 1 pools, 1 pgs
objects: 2 objects, 577 KiB
usage: 67 MiB used, 3.3 TiB / 3.3 TiB avail
pgs: 1 active+clean


$ ceph osd status
ID HOST USED AVAIL WR OPS WR DATA RD OPS RD DATA STATE
0 node-01 22.1M 1117G 0 0 0 0 exists,up
1 node-03 22.2M 1117G 0 0 0 0 exists,up
2 node-02 22.1M 1117G 0 0 0 0 exists,up


$ ceph osd pool ls detail
pool 1 '.mgr' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 1 pgp_num 1 autoscale_mode on last_change 18 flags hashpspool stripe_width 0 pg_num_max 32 pg_num_min 1 application mgr


$ rados df
POOL_NAME USED OBJECTS CLONES COPIES MISSING_ON_PRIMARY UNFOUND DEGRADED RD_OPS RD WR_OPS WR USED COMPR UNDER COMPR
.mgr 1.7 MiB 2 0 6 0 0 0 126 109 KiB 181 2.9 MiB 0 B 0 B

total_objects 2
total_used 67 MiB
total_avail 3.3 TiB
total_space 3.3 TiB




重新安装 rook-ceph 重置磁盘状态

DISK="/dev/sdX"

sgdisk --zap-all $DISK

dd if=/dev/zero of="$DISK" bs=1M count=100 oflag=direct,dsync

# 如果是固态盘使用下面命令 替换上面 `dd` 命令
blkdiscard $DISK