k8s 维护有状态服务难的问题,他解决了


 
 

 

 

介绍:它是基于 Kubernetes 的云原生数据基础设施,为用户提供了关系型数据库、NoSQL 数据库、向量数据库以及流计算系统的管理控制功能。可以使用提供的命令轻松部署处理数据库实例。

github:https://github.com/apecloud/kubeblocks

官网:https://kubeblocks.io

1.初步使用

安装kbcli:

官网说明:https://kubeblocks.io/docs/release-0.7/user_docs/installation/install-with-kbcli/install-kbcli

md-fences md-end-block ty-contain-cm modeLoaded highlighter- Bash
curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash
# 命令补全
kbcli completion zsh -h
echo "autoload -U compinit; compinit" >> ~/.zshrc
echo "source <(kbcli completion zsh); compdef _kbcli kbcli" >> ~/.zshrc

通过 kbcli 安装 KubeBlocks:

官网说明:https://kubeblocks.io/docs/release-0.7/user_docs/installation/install-with-kbcli/install-kubeblocks-with-kbcli

md-fences md-end-block ty-contain-cm modeLoaded highlighter- Dockerfile
# kbcli kubeblocks install
KubeBlocks will be installed to namespace "kb-system"
Kubernetes version 1.26.5
kbcli version 0.7.1
Collecting data from cluster                       OK
Kubernetes cluster preflight                       OK
Add and update repo kubeblocks                     OK
Install KubeBlocks 0.7.1                           OK
Wait for addons to be enabled
  apecloud-mysql                                   OK
  kafka                                            OK
  mongodb                                          OK
  mysql                                            OK
  postgresql                                       OK
  pulsar                                           OK
  redis                                            OK
  snapshot-controller                              OK
​
KubeBlocks 0.7.1 installed to namespace kb-system SUCCESSFULLY!
​
-> Basic commands for cluster:
    kbcli cluster create -h     # help information about creating a database cluster
    kbcli cluster list          # list all database clusters
    kbcli cluster describe <cluster name>  # get cluster information
​
-> Uninstall KubeBlocks:
    kbcli kubeblocks uninstall
​
​
# 查看启动容器
# kubectl get pod -n kb-system
NAME                                            READY   STATUS    RESTARTS   AGE
kb-addon-snapshot-controller-8484bbd44c-lc69m   1/1     Running   0          102s
kubeblocks-69b7c6db64-xskrj                     1/1     Running   0          2m22s
kubeblocks-dataprotection-67f46457c7-7s7kv      1/1     Running   0          2m22s
​
# 查看kubeblocks的状态
kbcli kubeblocks status
KubeBlocks is deployed in namespace: kb-system,version: 0.7.1
​
KubeBlocks Workloads:
NAMESPACE   KIND         NAME                           READY PODS   CPU(CORES)   MEMORY(BYTES)   CREATED-AT
kb-system   Deployment   kb-addon-snapshot-controller   1/1          N/A          N/A             Dec 03,2023 14:12 UTC+0800
kb-system   Deployment   kubeblocks                     1/1          N/A          N/A             Dec 03,2023 14:11 UTC+0800
kb-system   Deployment   kubeblocks-dataprotection      1/1          N/A          N/A             Dec 03,2023 14:11 UTC+0800
​
KubeBlocks Addons:
NAME                           STATUS     TYPE   PROVIDER
alertmanager-webhook-adaptor   Disabled   Helm   apecloud
apecloud-mysql                 Enabled    Helm   apecloud
apecloud-otel-collector        Disabled   Helm   apecloud
aws-load-balancer-controller   Disabled   Helm   N/A
bytebase                       Disabled   Helm   community
cert-manager                   Disabled   Helm   community
csi-hostpath-driver            Disabled   Helm   community
csi-s3                         Disabled   Helm   community
elasticsearch                  Disabled   Helm   community
external-dns                   Disabled   Helm   N/A
fault-chaos-mesh               Disabled   Helm   community
foxlake                        Disabled   Helm   community
grafana                        Disabled   Helm   community
greptimedb                     Disabled   Helm   community
jupyter-hub                    Disabled   Helm   community
jupyter-notebook               Disabled   Helm   community
kafka                          Enabled    Helm   community
kubebench                      Disabled   Helm   community
kubeblocks-csi-driver          Disabled   Helm   N/A
llm                            Disabled   Helm   community
loki                           Disabled   Helm   community
mariadb                        Disabled   Helm   community
migration                      Disabled   Helm   community
milvus                         Disabled   Helm   community
minio                          Disabled   Helm   community
mongodb                        Enabled    Helm   community
mysql                          Enabled    Helm   community
nebula                         Disabled   Helm   community
neon                           Disabled   Helm   community
nvidia-gpu-exporter            Disabled   Helm   community
nyancat                        Disabled   Helm   apecloud
opensearch                     Disabled   Helm   community
oracle-mysql                   Disabled   Helm   ApeCloud
orioledb                       Disabled   Helm   apecloud
polardbx                       Disabled   Helm   community
postgresql                     Enabled    Helm   community
prometheus                     Disabled   Helm   community
pulsar                         Enabled    Helm   community
pyroscope-server               Disabled   Helm   community
qdrant                         Disabled   Helm   community
redis                          Enabled    Helm   community
risingwave                     Disabled   Helm   community
snapshot-controller            Enabled    Helm   community
starrocks                      Disabled   Helm   community
tdengine                       Disabled   Helm   community
victoria-metrics-agent         Disabled   Helm   community
weaviate                       Disabled   Helm   community
xinference                     Disabled   Helm   community
zookeeper                      Disabled   Helm   community

2.创建MySQL

官网:https://kubeblocks.io/docs/release-0.7/user_docs/kubeblocks-for-mysql/cluster-management/create-and-connect-a-mysql-cluster

md-fences md-end-block ty-contain-cm modeLoaded highlighter- Bash
# 创建单实例
kbcli cluster create mysql mycluster
Info: --version is not specified, ac-mysql-8.0.30 is applied by default.
Cluster mycluster created
​
# 创建集群实例
kbcli cluster create mysql --mode raftGroup --availability-policy none  mysql-cluster
Info: --version is not specified, ac-mysql-8.0.30 is applied by default.
Cluster mysql-cluster created
​
# 连接MySQL
kbcli cluster connect mysql-cluster
Connect to instance mysql-cluster-mysql-1: out of mysql-cluster-mysql-1(leader), mysql-cluster-mysql-2(follower), mysql-cluster-mysql-0(follower)
Defaulted container "mysql" out of: mysql, metrics, vttablet, kb-checkrole, config-manager
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 58
Server version: 8.0.30 WeSQL Server - GPL, Release 5, Revision 4ca1eb8
​
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
​
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
​
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
​
mysql>

注:具体操作在官网已经写得很清楚,这里不在操作,可以根据官网进行容器数量的修改和内存和cpu的修改。

 

__EOF__

 
  • 本文作者: kerwin
  • 本文链接: https://www.cnblogs.com/-k8s/p/17872979.html
  • 关于博主: 评论和私信会在第一时间回复。或者直接私信我。
  • 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
  • 声援博主: 如果您觉得文章对您有帮助,可以点击文章右下角推荐】一下。
 
 
分类: kubernetes
   
0
0
 
 
 
« 上一篇: 探索在openebs中使用lvm做持久化
» 下一篇: helm部署Kafka集群
posted @ 2023-12-03 14:40  kerwin-  阅读(567)  评论(0)  编辑  收藏  举报
 
 
 
 
 
 
 
00:00 / 02:43 
 
   
 
 

作词 : Marlon McClain

作曲 : Cassio Lopes/Marlon McClain/Andrew Fedyk/Joseph De Pace

Babe, don't make a sound (宝贝, 别作声)

2 a.m. love gotta keep it down (keep it down) (凌晨2点了克制一下)

Don't wait around for a signal now (现在可不是空等信号的时候)

Gimme some verbs I ain't talkin' nouns (I'm naughty) (给我想些动词我不说名词(我不循规蹈矩))

You wanna ride in the 6 (你想在6点去玩)

You wanna dine in the six (dine in the six) (你想在6点吃饭)

But when I lean for the kiss (但是我想亲亲的时候)

You said I'll probably send you some pics (你说你要给我发照片)

And I'm like (我和你想得一样)

Hell nah, been waitin' too long (I've been waitin') (天呐,我等了很久了)

Hell nah, I want that crew love (don't leave, baby) (天呐, 我想我想要你所有的爱)

Hell nah, been waitin' too long (I've been waitin') (天呐, 我等了很久了)

Hell nah, I want that crew love (天呐,我想我想要你所有的爱)

Body on my, losin' all my innocence (让我切身了解你, 快要失掉我的节操了)

Body on my, grindin' on my innocence (让我切身了解你, 快要失掉我的节操了)

Body on my, losin' all my innocence (让我切身了解你, 快要失掉我的节操了)

Body on my, grindin' on my innocence (让我切身了解你, 快要失掉我的节操了)

Body on my, losin' all my innocence (让我切身了解你, 快要失掉我的节操了)

Body on my, grindin' on my innocence (让我切身了解你, 快要失掉我的节操了)

Body on my, losin' all my innocence (让我切身了解你, 快要失掉我的节操了)

Body on my, grindin' on my innocence (让我切身了解你, 快要失掉我的节操了)

On my, on my, on my, on my 'cence (让我来体贴你,接受我的“检查”)

On my, on my, on my, on my 'cence (让我来体贴你,接受我的“检查”)

On my, on my, on my, on my 'cence (让我来体贴你,接受我的“检查”)

On my, on my, on my, on my 'cence (让我来体贴你,接受我的“检查”)

Babe, just hit the pedal (宝贝,踩好踏板哦)

If things go wrong it's just incidental (一切都是意外如果有不好的什么事)

My bad, never got the memo (我的错 从不记备忘录)

But you never have fun while you're in the limo, yeah (但你在豪车里绝不会快乐)

If you wanna ride in the 6 (如果你想在6点去骑行)

You wanna dine in the six (dine in the six) (你想在6点用餐吗)

You wanna lean for the kiss (你想亲亲吗)

You said I'll probably send you some pics (你说你会寄些图片给我)

And I'm like (和我想得一样)

Hell nah, been waitin' too long (I've been waitin') (天呐,我等了很久了)

Hell nah, I want that crew love (don't leave, baby) (天呐,我想要你所有的爱)

Hell nah, been waitin' too long (I've been waitin') (天呐,我等了很久了)

Hell nah, I want that crew love (天呐,我想要你所有的爱)

Body on my, losin' all my innocence (让我切身了解你, 快要失掉我的节操了)

Body on my, grindin' on my innocence (让我切身了解你, 快要失掉我的节操了)

Body on my, losin' all my innocence (让我切身了解你, 快要失掉我的节操了)

Body on my, grindin' on my innocence (让我切身了解你, 快要失掉我的节操了)

Body on my, losin' all my innocence (让我切身了解你, 快要失掉我的节操了)

Body on my, grindin' on my innocence (让我切身了解你, 快要失掉我的节操了)

On my, on my, on my, on my 'cence (让我来体贴你,接受我的“检查”)

On my, on my, on my, on my 'cence (让我来体贴你,接受我的“检查”)

On my, on my, on my, on my 'cence (让我来体贴你,接受我的“检查”)

On my, on my, on my, on my 'cence, (让我来体贴你,接受我的“检查”)

posted @ 2024-05-14 19:24  技术颜良  阅读(24)  评论(0编辑  收藏  举报