misterli's Blog.

misterli's Blog.

欢迎您访问misterli's Blog.

利用k8s审计日志生成RBAC规则

简介

很多时候我们在k8s上安装服务会遇到各种各样的权限问题,有时候为某个用户或者serviceaccount对象生成一个合适的role会比较头疼,这里推荐一个工具audit2rbac,它可以根据k8s的审计日志,为指定用户或者serviceaccount对象生成它们所需要的role.

audit2rbac下载地址: https://github.com/liggitt/audit2rbac/releases

前提要求

1、集群已经开启审计日志,且日志格式为json格式,开启审计日志可以参考https://kubernetes.io/docs/tasks/debug-application-cluster/audit/#advanced-audit

2、建议日志级别设置为Metadata,还可以减少日志大小

使用

我们这里已经开启了审计日志,这里截取一小段日志内容如下:

1
2
{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"571b8d06-aa30-4aec-87cb-7bef2ef88d18","stage":"ResponseComplete","requestURI":"/apis/coordination.k8s.io/v1/namespaces/longhorn-system/leases/external-resizer-driver-longhorn-io","verb":"update","user":{"username":"system:serviceaccount:longhorn-system:longhorn-service-account","uid":"cdb0a05f-170d-4f02-aeec-88af904e68f7","groups":["system:serviceaccounts","system:serviceaccounts:longhorn-system","system:authenticated"]},"sourceIPs":["172.20.166.16"],"userAgent":"csi-resizer/v0.0.0 (linux/amd64) kubernetes/$Format","objectRef":{"resource":"leases","namespace":"longhorn-system","name":"external-resizer-driver-longhorn-io","uid":"81766194-e2e3-4edd-83d7-788a07562b91","apiGroup":"coordination.k8s.io","apiVersion":"v1","resourceVersion":"18772044"},"responseStatus":{"metadata":{},"code":200},"requestReceivedTimestamp":"2021-01-06T03:02:52.709670Z","stageTimestamp":"2021-01-06T03:02:52.710917Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":"RBAC: allowed by ClusterRoleBinding \"longhorn-bind\" of ClusterRole \"longhorn-role\" to ServiceAccount \"longhorn-service-account/longhorn-system\""}}
{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"0795fecc-38ea-46d7-a27d-6e73e6a27cd8","stage":"ResponseComplete","requestURI":"/apis/coordination.k8s.io/v1/namespaces/longhorn-system/leases/driver-longhorn-io","verb":"get","user":{"username":"system:serviceaccount:longhorn-system:longhorn-service-account","uid":"cdb0a05f-170d-4f02-aeec-88af904e68f7","groups":["system:serviceaccounts","system:serviceaccounts:longhorn-system","system:authenticated"]},"sourceIPs":["172.20.166.16"],"userAgent":"csi-provisioner/v0.0.0 (linux/amd64) kubernetes/$Format","objectRef":{"resource":"leases","namespace":"longhorn-system","name":"driver-longhorn-io","apiGroup":"coordination.k8s.io","apiVersion":"v1"},"responseStatus":{"metadata":{},"code":200},"requestReceivedTimestamp":"2021-01-06T03:02:52.713255Z","stageTimestamp":"2021-01-06T03:02:52.713894Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":"RBAC: allowed by ClusterRoleBinding \"longhorn-bind\" of ClusterRole \"longhorn-role\" to ServiceAccount \"longhorn-service-account/longhorn-system\""}}

接下来我们使用audit2rbac为serviceaccount:longhorn-system:longhorn-service-account生成rbac role

同步secret和config到指定namespace

简介

Synator可以将Secrets和ConfigMap在我们集群的namespace中同步,实现一步在集群多个namespace创建secrets和configmap,可以用来创建一些集群中多个namespace都需要的secerts和configmap咨询,如镜像的拉取凭证

项目:https://github.com/TheYkk/synator.git

安装

1
2
3
git clone https://github.com/TheYkk/synator.git
cd synctor
kubectl apply -f deploy.yml

安装后可以查看

1
2
3
[root@master-01 sync-cm-secret]# kubectl get pod -l name=synator
NAME READY STATUS RESTARTS AGE
synator-77f47f7dfb-jbrq5 1/1 Running 0 13m

使用

1、添加注解synator/sync=yes到Secret或ConfigMap即可,还可以使用注解synator/include-namespaces='namespace1,namespace2' 设置同步到哪些名称空间,或者使用注解synator/exclude-namespaces='kube-system,kube-node-lease 排除某些名称空间

例如我们创建一个secrets并设置同步到kuboard和monitoring这两个namespace下

kubevela之appfile详解(下)

上一篇我们介绍了appfile中服务的几种类型以及相关参数,这一篇我们介绍一些appfile的traits。在traits中可以配置一些运维策略,包括routes(ingress ), auto-scaling , rollout, metrics.

routes

Route 用于配置对服务的外部访问。

可用属性列表

1
2
3
4
5
6
7
8
9
10
11
name: my-app-name

services:
my-service-name:
...
route:
domain: example.com
issuer: tls
rules:
- path: /testapp
rewriteTarget: /

参数说明:

名称 类型 描述 笔记
domain string 指定此应用程序的URL [默认为(空)]
issuer string 指定是否使用cert-manager创建ssl证书。 [默认为不使用tls]
rules [[] RouteRules](见下表) [可选的]

RouteRules

名称 类型 描述 笔记
path string [默认为(空)]
RewriteTarget string [默认为(空)]

示例:

kubevela之appfile详解(上)

上一篇我们使用vela部署了一个简单的服务,下面我们部署一个完整的服务并学习一下appfile该如何去写

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
vela.yaml
name: testapp

services:
test-web-service:
# this image will be used in both build and deploy steps
image: christianhxc/gorandom:1.0

type: webservice

port: 8080
cpu: "0.1"
env:
- name: FOO
value: bar
scaler:
replicas: 1

route:
domain: kubevela.lishuai.fun
rules:
- path: /

metrics:
enabled: true
format: prometheus
path: /metrics
port: 0
scheme: http

autoscale:
min: 1
max: 4
cron:
startAt: "15:40"
duration: "3m"
days: "Monday, Thursday"
replicas: 2
timezone: "Asia/Shanghai"


test-worker:
type: worker
image: oamdev/testapp:v1
cmd: ["node", "server.js"]

test-task:
type: task
image: perl
count: 10
restart: Never
cmd: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]

部署上面的vela.yaml之后vela根据文件的内容为我们创建了相关的pod,service,job,ingress。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[root@master-01 testapp]# vela up 
Parsing vela.yaml ...
Loading templates ...

Rendering configs for service (test-task)...

Rendering configs for service (test-web-service)...

Rendering configs for service (test-worker)...
Writing deploy config to (.vela/deploy.yaml)

Applying deploy configs ...
Checking if app has been deployed...
App exists, updating existing deployment...
✅ App has been deployed 🚀🚀🚀
Port forward: vela port-forward testapp
SSH: vela exec testapp
Logging: vela logs testapp
App status: vela status testapp
Service status: vela status testapp --svc test-task
Service status: vela status testapp --svc test-web-service
Service status: vela status testapp --svc test-worker
[root@master-01 testapp]# kubectl get pod,svc,job,ingress
NAME READY STATUS RESTARTS AGE
pod/check-ecs-price-7cdc97b997-j9w9q 1/1 Running 0 11d
pod/test-task-59hqm 1/1 Running 0 17s
pod/test-task-bp8f4 0/1 ContainerCreating 0 17s
pod/test-task-fh7zf 0/1 ContainerCreating 0 17s
pod/test-task-gv44j 0/1 ContainerCreating 0 17s
pod/test-task-lqrds 0/1 ContainerCreating 0 17s
pod/test-task-mn8z9 0/1 ContainerCreating 0 17s
pod/test-task-swzg5 0/1 ContainerCreating 0 17s
pod/test-task-xg2nq 0/1 ContainerCreating 0 17s
pod/test-task-xz5h2 0/1 ContainerCreating 0 17s
pod/test-task-zfjm8 0/1 ContainerCreating 0 17s
pod/test-web-service-5dff6fd5d-gw7bd 1/1 Running 0 17s

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 13d
service/oam-metricapp ClusterIP 10.104.9.200 <none> 4848/TCP 16h
service/oam-test-web-service ClusterIP 10.104.240.83 <none> 4848/TCP 4m56s
service/test-web-service-route-5897fbd549 ClusterIP 10.103.62.97 <none> 8080/TCP 16s
service/traefik-forward-auth ClusterIP 10.96.227.183 <none> 4181/TCP 13d

NAME COMPLETIONS DURATION AGE
job.batch/test-task 0/10 17s 17s

NAME CLASS HOSTS ADDRESS PORTS AGE
ingress.extensions/test-web-service-route-5897fbd549-0 <none> kubevela.lishuai.fun 80 16s
[root@master-01 testapp]# curl kubevela.lishuai.fun/metrics
# HELP go_build_info Build information about the main Go module.
# TYPE go_build_info gauge
go_build_info{checksum="unknown",path="unknown",version="unknown"} 1
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 2.8372e-05
go_gc_duration_seconds{quantile="0.25"} 2.8372e-05
go_gc_duration_seconds{quantile="0.5"} 6.7686e-05
go_gc_duration_seconds{quantile="0.75"} 7.9579e-05
go_gc_duration_seconds{quantile="1"} 7.9579e-05
go_gc_duration_seconds_sum 0.000175637

接下来我们看一下appfile文件的结构,Appfile所有可用部分的列表如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: _app-name_   #定义这个app的名称

services:
_service-name_: #_service
# If `build` section exists, this field will be used as the name to build image. Otherwise, KubeVela will try to pull the image with given name directly.
image: oamdev/testapp:v1

build:
docker:
file: _Dockerfile_path_ # relative path is supported, e.g. "./Dockerfile"
context: _build_context_path_ # relative path is supported, e.g. "."

push:
local: kind # optionally push to local KinD cluster instead of remote registry

type: webservice (default) | worker | task

# detailed configurations of workload
... properties of the specified workload ...

_trait_1_:
# properties of trait 1

_trait_2_:
# properties of trait 2

... more traits and their properties ...

_another_service_name_: # more services can be defined
...

appfile文件主要分为两个部分

描述
name 定义了我们要定义的app的名称
services 定义了我们要创建的application的具体,services段下可以定义多个服务。

Workload type

services可以配置多个服务,每个服务根据workload type不同会被创建为不同的k8s中的资源对象,vela暂时具有以下三种workload type

kubevela小试牛刀(1)

什么是kubevela

KubeVela 是一个简单易用且高度可扩展的应用管理平台与核心引擎。KubeVela 是基于 Kubernetes 与 Open Application Model(OAM) 技术构建的。

OAM 全称是 Open Application Model,从名称上来看它所定义的就是一种模型,同时也实现了基于 OAM 的我认为这种模型旨在定义了云原生应用的标准。

  • 开放(Open):支持异构的平台、容器运行时、调度系统、云供应商、硬件配置等,总之与底层无关
  • 应用(Application):云原生应用
  • 模型(Model):定义标准,以使其与底层平台无关

在 OAM 中,一个应用程序包含三个核心理念。

  • 第一个核心理念是组成应用程序的组件(Component),它可能包含微服务集合、数据库和云负载均衡器;
  • 第二个核心理念是描述应用程序运维特征(Trait)的集合,例如,弹性伸缩和 Ingress 等功能。它们对应用程序的运行至关重要,但在不同环境中其实现方式各不相同;
  • 最后,为了将这些描述转化为具体的应用程序,运维人员使用应用配置(Application Configuration)来组合组件和相应的特征,以构建应部署的应用程序的具体实例

对于开发人员来说,KubeVela本身是一个易于使用的工具,能够以最小的工作量描述应用程序并将其发布到Kubernetes。只需管理一个以应用程序为中心的工作流程即可轻松地与任何CI / CD管道集成,无需管理少量的Kubernetes YAML文件,只需一个简单的docker -compose样式的Appfile

对于平台开发人员来说,KubeVela是一个框架,使他们能够轻松创建面向开发人员的高度可扩展的平台。详细地说,KubeVela通过执行以下操作减轻了构建此类平台的麻烦:

  • 以应用为中心。在Appfile的后面,KubeVela实施了一个应用程序概念,因为它的主要API和ALL KubeVela的功能仅满足应用程序的需求。这是通过采用开放应用程序模型作为KubeVela的核心API来实现的。
  • 本地扩展。KubeVela中的应用程序由各种可插拔工作负载类型和操作功能(即特征)组成。Kubernetes生态系统的功能可以随时通过Kubernetes CRD注册机制作为新的工作负载类型或特征添加到KubeVela中。
  • 简单但可扩展的抽象机制。KubeVela的主要用户界面(即Appfile和CLI)使用基于CUELang的抽象引擎构建,该引擎将面向用户的模式转换为下划线的Kubernetes资源。KubeVela提供了一组内置的抽象对象,平台构建者可以随时随意对其进行修改。抽象更改将在运行时生效,无需重新编译或重新部署KubeVela。

架构

使用Rancher的rke安装k8s

主机列表

主机名 公网ip 内网ip 系统 使用用户
rke-test-master-01 180.153.180.33 192.168.0.60 Ubuntu 18.04 robot
Rke-test-master-02 180.153.180.11 192.168.0.31 Ubuntu 18.04 robot
Rke-test-master-03 180.153.180.23 192.168.0.65 Ubuntu 18.04 robot
rke-test-node-01 180.153.180.34 192.168.0.55 Ubuntu 18.04 Robot

负载均衡slb

负载均衡slb的6443端口采用轮询方式代理rke-test-master-01 rke-test-master-02 rke-test-master-03的6443端口

安装docker及配置

参考:https://docs.docker.com/engine/install/ubuntu/

卸载旧版本

如果之前安装旧版本,需要先卸载:

1
$ sudo apt-get remove docker docker-engine docker.io containerd runc

设置仓库

Prometheus监控redis及redis-cluster

Prometheus监控redis及redis-cluster

Redis应用没有自带的/metrics接口,我们就需要利用exporter服务来为prometheus提供指标数据。

项目地址: https://github.com/oliver006/redis_exporter.git

监控单个redis

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-exporter
namespace: monitoring
labels:
k8s-app: redis-exporter
spec:
selector:
matchLabels:
k8s-app: redis-exporter
template:
metadata:
labels:
k8s-app: redis-exporter
spec:
containers:
- name: redis-exporter001
image: oliver006/redis_exporter:latest
args: ["-redis.addr","xxx","-redis.password", "xxx"]
ports:
- containerPort: 9121
name: http
---
apiVersion: v1
kind: Service
metadata:
labels:
k8s-app: redis-exporter
name: redis-exporter
namespace: monitoring
spec:
ports:
- name: http
port: 9121
targetPort: http
selector:
k8s-app: redis-exporter

命令行常用选项介绍:

名称 环境变量名称 描述
redis.addr REDIS_ADDR Redis实例的地址,默认为redis://localhost:6379
redis.user REDIS_USER 用于认证的用户名(Redis ACL for Redis 6.0及更高版本)。
redis.password REDIS_PASSWORD Redis实例的密码,默认为""(无密码)。

我们在部署一个servicemonitor抓取一下这个exporter

1
2
3
4
5
6
7
8
9
10
11
12
13
14
metadata:
labels:
k8s-app: redis-exporter
prometheus.io/monitor: "true"
name: redis-exporter
namespace: monitoring
spec:
endpoints:
- interval: 30s
port: http
jobLabel: redis-exporter
selector:
matchLabels:
k8s-app: redis-exporter

稍等片刻我们prometheus ui上就可以显示这个exporter

Argo CD使用ding talk通知同步状态

Argo CD使用ding talk通知同步状态

实际使用中,我们可能会想把Argo CD中app的同步状态发送到指定媒介。但是Argo CD本身并未内置同步状态通知功能,但是可以与第三方通知系统的集成。

如果需要监视Argo CD的性能或托管应用程序的运行状况,可以将Prometheus MetricsGrafanaAlertmanager结合使用。

如果我们要将应用程序同步状态,比如同步中,同步成功,同步失败,同步状态未知等事件通知给使用Argo CD的最终用户,我们这里使用ArgoCD Notifications这个服务。argocd-notifications是特定于Argo CD的通知系统,可连续监视Argo CD应用程序,并旨在与各种通知服务(例如Slack,SMTP,Telegram,Discord,webhooks等)集成。

项目地址:https://github.com/argoproj-labs/argocd-notifications.git

安装与配置

先下载安装文件

1
wget https://raw.githubusercontent.com/argoproj-labs/argocd-notifications/stable/manifests/install.yaml

这里我们需要修改install.yaml中的argocd-notifications-cm argocd-notifications-secret 添加相关配置才能支持ding talk.

修改后的argocd-notifications-cm和argocd-notifications-secret

k8s集群中pod镜像版本检查

概述

version-checker用于观察k8s集群中运行的镜像的当前版本以及上游可用的最新版本。这些检查作为Prometheus指标公开,可以在gara fana上查看。

该工具目前处于实验阶段。

version-checker支持以下仓库:

  • ACR
  • Docker Hub
  • ECR
  • GCR (inc gcr facades such as k8s.gcr.io)
  • Quay
  • 自托管(符合Docker V2 API的registry,例如harbor,artifactory等)。可以一次配置多个自托管registry。

这些镜像仓库支持身份验证。

项目地址:https://github.com/jetstack/version-checker.git

安装

可以使用官方提供的yaml文件或者helm文件安装, 均在项目下的deploy目录下

yaml安装

阿里云rds 备份恢复到本地

记一次阿里云rds 备份恢复到本地

公司阿里云rds不再使用后,做了备份然后实例释放了,本来是设置的实例删除还保留最后一次备份,以便后期需要这个数据库数据时方便启动一个临时实例查询数据。今天突然接到查询这个数据库的需求,登上控制台发现备份的数据并没有保留,这里不再纠结为啥么没有保留了,之前下载实例到云盘后做了快照。既然不能用备份点点点创建实例,只能自己动手丰衣足食了。

这里果断新开一个竞价ecs,并用之前保存备份的快创建一块云盘,然后在创建两块350g的云盘挂载使用,过程略,结果如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@iZuf65ck5g7o2ifsthvuhqZ mysql]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 7.7G 0 7.7G 0% /dev
tmpfs 7.7G 0 7.7G 0% /dev/shm
tmpfs 7.7G 652K 7.7G 1% /run
tmpfs 7.7G 0 7.7G 0% /sys/fs/cgroup
/dev/vda1 40G 3.4G 35G 10% /
tmpfs 1.6G 0 1.6G 0% /run/user/0
/dev/vdb1 79G 60G 15G 80% /backup #存放压缩的备份文件
/dev/vdc1 345G 230G 98G 71% /home/mysql/data #解压备份文件
/dev/vdd1 345G 230G 98G 71% /var/lib/mysql # mysql数据目录
[root@iZuf65ck5g7o2ifsthvuhqZ mysql]# ls -lh /backup/
总用量 60G
drwx------ 2 root root 16K 10月 30 10:25 lost+found
-rw-r--r-- 1 root root 58G 10月 28 10:56 tvm-mysql-backup-20201031.tar.gz

解压后如下:

1
2
3
4
5
6
[root@iZuf65ck5g7o2ifsthvuhqZ mysql]# ls /home/mysql/data/
afcsdbkd8t75vfh79 ib_logfile0 mysql tokudb.environment xtrabackup_binlog_pos_innodb xtrabackup_slave_filename_info
backup-my.cnf ib_logfile1 performance_schema tokudb.rollback xtrabackup_checkpoints xtrabackup_slave_info
devtest171108v101 iZuf65ck5g7o2ifsthvuhqZ.err test tsmd232e29c64s xtrabackup_info
ibdata1 log000000000007.tokulog29 tokudb.directory xtrabackup_binlog_info xtrabackup_logfile

首先我们之前使用的是mysql 5.6 ,这里先安装mysql 5.6

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
rpm -qa|grep mariadb|xargs rpm -e --nodeps
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
[root@iZuf65ck5g7o2ifsthvuhqZ ~]# yum install mysql-server
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-server.x86_64.0.5.6.50-2.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 5.6.50-2.el7,它被软件包 mysql-community-server-5.6.50-2.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) >= 5.6.10,它被软件包 mysql-community-server-5.6.50-2.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mysql-community-client.x86_64.0.5.6.50-2.el7 将被 安装
--> 正在处理依赖关系 mysql-community-libs(x86-64) >= 5.6.10,它被软件包 mysql-community-client-5.6.50-2.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.5.6.50-2.el7 将被 安装
--> 正在检查事务
---> 软件包 mysql-community-libs.x86_64.0.5.6.50-2.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

====================================================================================================================================================================================
Package 架构 版本 源 大小
====================================================================================================================================================================================
正在安装:
mysql-community-server x86_64 5.6.50-2.el7 mysql56-community 67 M
为依赖而安装:
mysql-community-client x86_64 5.6.50-2.el7 mysql56-community 21 M
mysql-community-common x86_64 5.6.50-2.el7 mysql56-community 287 k
mysql-community-libs x86_64 5.6.50-2.el7 mysql56-community 2.2 M

事务概要
====================================================================================================================================================================================
安装 1 软件包 (+3 依赖软件包)

总下载量:90 M
安装大小:362 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.50-2.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEYB/s | 355 kB 00:04:49 ETA
mysql-community-common-5.6.50-2.el7.x86_64.rpm 的公钥尚未安装
(1/4): mysql-community-common-5.6.50-2.el7.x86_64.rpm | 287 kB 00:00:00
(2/4): mysql-community-libs-5.6.50-2.el7.x86_64.rpm | 2.2 MB 00:00:01
(3/4): mysql-community-client-5.6.50-2.el7.x86_64.rpm | 21 MB 00:00:06
(4/4): mysql-community-server-5.6.50-2.el7.x86_64.rpm | 67 MB 00:00:15
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 5.2 MB/s | 90 MB 00:00:17
从 file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥
导入 GPG key 0x5072E1F5:
用户ID : "MySQL Release Engineering <[email protected]>"
指纹 : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
软件包 : mysql-community-release-el7-5.noarch (@/mysql-community-release-el7-5.noarch)
来自 : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : mysql-community-common-5.6.50-2.el7.x86_64 1/4
正在安装 : mysql-community-libs-5.6.50-2.el7.x86_64 2/4
正在安装 : mysql-community-client-5.6.50-2.el7.x86_64 3/4
正在安装 : mysql-community-server-5.6.50-2.el7.x86_64 4/4
验证中 : mysql-community-common-5.6.50-2.el7.x86_64 1/4
验证中 : mysql-community-libs-5.6.50-2.el7.x86_64 2/4
验证中 : mysql-community-client-5.6.50-2.el7.x86_64 3/4
验证中 : mysql-community-server-5.6.50-2.el7.x86_64 4/4

已安装:
mysql-community-server.x86_64 0:5.6.50-2.el7

作为依赖被安装:
mysql-community-client.x86_64 0:5.6.50-2.el7 mysql-community-common.x86_64 0:5.6.50-2.el7 mysql-community-libs.x86_64 0:5.6.50-2.el7

完毕!
[root@iZuf65ck5g7o2ifsthvuhqZ ~]# rpm -qa | grep mysql
mysql-community-common-5.6.50-2.el7.x86_64
mysql-community-libs-5.6.50-2.el7.x86_64
mysql-community-server-5.6.50-2.el7.x86_64
mysql-community-release-el7-5.noarch
mysql-community-client-5.6.50-2.el7.x86_64

安装备份恢复工具xtrabackup,注意MySQL 5.6及之前的版本需要安装 Percona XtraBackup 2.3

1
2
$ wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.3.5/binary/redhat/7/x86_64/percona-xtrabackup-2.3.5-1.el7.x86_64.rpm
$ yum localinstall percona-xtrabackup-2.3.2-1.el7.x86_64.rpm
avatar
misterli
大风起兮云飞扬
FRIENDS
baidu google