Blog

Kubernetes的组成和资源对象简介

2017-04-08
Kubernetes

1.Kubernetes简介 #

1.1 Kubernetes和微服务 #

在介绍Kubernetes之前,我们先来了解一下云原生架构。 云原生的概念最早在2013年由Pivotal的Matt Stine提出。 经过社区不断完善, 包括Agile Infrastructure, Continuous Delivery, DevOps, Microservices, 12 Factor App等几大主题 。 这几大主题都是一些理论或实践方法,伴随着这些理论和实践必然存在一系列的平台和工具。

...

Ceph运维常用命令

2017-04-07
Ceph

1.集群管理 #

1.1 启动和停止各组件 #

查看当前节点的systemd unit服务:

1systemctl list-units 'ceph*' --type=service
2UNIT                           LOAD   ACTIVE SUB     DESCRIPTION
3ceph-mgr@node1.service         loaded active running Ceph cluster manager daemon
4ceph-mon@node1.service         loaded active running Ceph cluster monitor daemon
5ceph-osd@0.service             loaded active running Ceph object storage daemon osd.0
6ceph-radosgw@rgw.node1.service loaded active running Ceph rados gateway

查看某个服务是否开机启动:

1systemctl is-enabled [email protected]
2enabled

确认了相关的systemd unit后就可以使用systemd在Ceph集群各个节点上启动或停止各个Ceph组件。

...

Ceph Kraken 11.2.0部署记录

2017-04-06
Ceph

本文记录在测试环境中部署Ceph Kraken的完整过程。 我们的线上环境主要使用Ceph的块存储RBD作为Kubernetes的存储卷,同时使用Ceph的对象存储RGW作为各种服务的对象存储,最后对这两种使用场景做一个整理。

环境准备 #

1192.168.61.41 node1 - admin-node, deploy-node, mon, osd.0
2192.168.61.42 node2 - mon, osd.1
3192.168.61.43 node3 - mon, osd.2

在node1上配置Ceph yum源 /etc/yum.repos.d/ceph.repo, 根据GET PACKAGES选择kraken的地址:

...

使用kubeadm安装Kubernetes 1.6

2017-04-05
Kubernetes

环境准备 #

1192.168.61.41 node1
2192.168.61.42 node2
3192.168.61.43 node3

安装Docker 1.12 #

Kubernetes 1.6还没有针对docker 1.13和最新的docker 17.03上做测试和验证,所以这里安装Kubernetes官方推荐的Docker 1.12版本。

1yum install -y yum-utils
2
3yum-config-manager \
4    --add-repo \
5    https://docs.docker.com/v1.13/engine/installation/linux/repo_files/centos/docker.repo
6    
7yum makecache fast

查看版本:

...

Kubernetes 1.6新特性

2017-03-29
Kubernetes

Kubernetes 1.6已结发布,包括9个Stable特性、12个Beta特性、8个Alpha特性,共29个新特性。 Kubernetes 1.6重点关注集群规模扩展和自动化。目前最多支持5000个节点的集群;动态存储配置特性进入Stable;基于角色的访问控制(RBAC)、kubefed、kubeadm以及一些调度特性进入Beta。

...

容器网络接口CNI的整理

2017-03-24
Cni

CNI(Container Network Interface即容器网络接口)是由CoreOS提出的一个容器网络规范,包含方法规范、参数规范等,是Linux容器网络配置的一组标准和库,用户可以根据这些标准和库来开发自己的容器网络插件。CNI已经被Kubernetes、Mesos、Cloud Foundry、rkt使用,同时Calico、Weave等项目都为CNI提供插件。

...

Redis 3.2集群环境搭建和测试

2017-03-06
Redis

Redis 3开始支持了Cluster模式,增强了Redis的水平扩展能力,Redis Cluster的节点分片通过hash slot实现,每个节点上的键都属于16384(0~16383)个slots中的一个,每个节点负责处理一部分slots。 Redis Cluster采用无中心节点方式实现,无需proxy代理,客户端直接与redis集群的每个节点连接,根据同样的hash算法计算出key对应的slot,然后直接在slot对应的Redis上执行命令。

...

使用MySQL的可传输表空间特性恢复表或迁移表数据

2017-03-05
Mysql

在MySQL运维中可能会遇到以下两个需求的场景,一个是从MySQL的备份中恢复单个表;另一个是将一套环境数据库某个表中的数据导入到另一套环境的数据中。 对于前者肯定需要用到数据库的备份,而对于后者如果使用普通的mysqldump导出表数据再导入的方式将十分缓慢。 MySQL从5.6开始支持了可传输表空间(Transportable Tablespaces)特性,该特性允许表空间(table.ibd)从一个实例拷贝到另一个实例上,使用这个特性可以实现前面提到的两个运维场景。

...

MySQL多源复制故障修复, 重新初始化一个channel的复制

2017-03-04
Mysql

MySQL 5.7数据库多源复制拓扑如下:

1M1 --------+
2           |
3           |
4           v
5M2 ------->S

M1和M2为两个主数据库实例,S为从数据库实例,建立了从M1到S和从M2到S的多源复制。

S上执行:

  1SHOW SLAVE STATUS \G
  2*************************** 1. row ***************************
  3               Slave_IO_State: Waiting for master to send event
  4                  Master_Host: x.x.x.x
  5                  Master_User: repl
  6                  Master_Port: 3306
  7                Connect_Retry: 60
  8              Master_Log_File: binlog.000106
  9          Read_Master_Log_Pos: 15847815
 10               Relay_Log_File: relay-bin-m1.000003
 11                Relay_Log_Pos: 15684092
 12        Relay_Master_Log_File: binlog.000106
 13             Slave_IO_Running: Yes
 14            Slave_SQL_Running: Yes
 15              Replicate_Do_DB: 
 16          Replicate_Ignore_DB: 
 17           Replicate_Do_Table: 
 18       Replicate_Ignore_Table: 
 19      Replicate_Wild_Do_Table: 
 20  Replicate_Wild_Ignore_Table: sys.%,performance_schema.%,mysql.%,information_schema.%
 21                   Last_Errno: 0
 22                   Last_Error: 
 23                 Skip_Counter: 0
 24          Exec_Master_Log_Pos: 15847815
 25              Relay_Log_Space: 15684290
 26              Until_Condition: None
 27               Until_Log_File: 
 28                Until_Log_Pos: 0
 29           Master_SSL_Allowed: No
 30           Master_SSL_CA_File: 
 31           Master_SSL_CA_Path: 
 32              Master_SSL_Cert: 
 33            Master_SSL_Cipher: 
 34               Master_SSL_Key: 
 35        Seconds_Behind_Master: 0
 36Master_SSL_Verify_Server_Cert: No
 37                Last_IO_Errno: 0
 38                Last_IO_Error: 
 39               Last_SQL_Errno: 0
 40               Last_SQL_Error: 
 41  Replicate_Ignore_Server_Ids: 
 42             Master_Server_Id: 86
 43                  Master_UUID: @17070e4d-a4bc-49b6-88d4-cbbc610abc2b
 44             Master_Info_File: mysql.slave_master_info
 45                    SQL_Delay: 0
 46          SQL_Remaining_Delay: NULL
 47      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
 48           Master_Retry_Count: 86400
 49                  Master_Bind: 
 50      Last_IO_Error_Timestamp: 
 51     Last_SQL_Error_Timestamp: 
 52               Master_SSL_Crl: 
 53           Master_SSL_Crlpath: 
 54           Retrieved_Gtid_Set: 134db0a3-61a4-4f96-8574-a3ec77045987:68811801-68821751
 55            Executed_Gtid_Set: 30d1ce13-e8b0-43ae-b989-667aa0394fb8:1-240,
 56f7123455-4085-4e24-a028-e0cff16d1cc6:1-8409014,
 57f0c67103-9183-46c3-b34f-1b7fac7c0f51:1,
 5817070e4d-a4bc-49b6-88d4-cbbc610abc2b:1,
 59bb09bbce-c153-4af2-ab6f-85e70b74a13c:1-3,
 60cc96b6de-d317-4881-9a86-9c9b690cb8cc:1-15,
 61178dde0c-492c-4365-96e2-57008f2bd232:1-524521756,
 62da0e0547-a1ca-4cae-8db9-f3a90b3a996a:1,
 63134db0a3-61a4-4f96-8574-a3ec77045987:1-68821751
 64                Auto_Position: 1
 65         Replicate_Rewrite_DB: 
 66                 Channel_Name: m1
 67           Master_TLS_Version: 
 68*************************** 2. row ***************************
 69               Slave_IO_State: Waiting for master to send event
 70                  Master_Host: x.x.x.x
 71                  Master_User: repl
 72                  Master_Port: 3306
 73                Connect_Retry: 60
 74              Master_Log_File: binlog.002584
 75          Read_Master_Log_Pos: 127954993
 76               Relay_Log_File: relay-bin-m2.003944
 77                Relay_Log_Pos: 127955152
 78        Relay_Master_Log_File: binlog.002584
 79             Slave_IO_Running: Yes
 80            Slave_SQL_Running: Yes
 81              Replicate_Do_DB: 
 82          Replicate_Ignore_DB: 
 83           Replicate_Do_Table: 
 84       Replicate_Ignore_Table: 
 85      Replicate_Wild_Do_Table: 
 86  Replicate_Wild_Ignore_Table: sys.%,performance_schema.%,mysql.%,information_schema.%
 87                   Last_Errno: 0
 88                   Last_Error: 
 89                 Skip_Counter: 0
 90          Exec_Master_Log_Pos: 127954993
 91              Relay_Log_Space: 127955430
 92              Until_Condition: None
 93               Until_Log_File: 
 94                Until_Log_Pos: 0
 95           Master_SSL_Allowed: No
 96           Master_SSL_CA_File: 
 97           Master_SSL_CA_Path: 
 98              Master_SSL_Cert: 
 99            Master_SSL_Cipher: 
100               Master_SSL_Key: 
101        Seconds_Behind_Master: 0
102Master_SSL_Verify_Server_Cert: No
103                Last_IO_Errno: 0
104                Last_IO_Error: 
105               Last_SQL_Errno: 0
106               Last_SQL_Error: 
107  Replicate_Ignore_Server_Ids: 
108             Master_Server_Id: 69
109                  Master_UUID: c8822a1d-d39c-11e9-8301-fa163e13923c
110             Master_Info_File: mysql.slave_master_info
111                    SQL_Delay: 0
112          SQL_Remaining_Delay: NULL
113      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
114           Master_Retry_Count: 86400
115                  Master_Bind: 
116      Last_IO_Error_Timestamp: 
117     Last_SQL_Error_Timestamp: 
118               Master_SSL_Crl: 
119           Master_SSL_Crlpath: 
120           Retrieved_Gtid_Set: 178dde0c-492c-4365-96e2-57008f2bd232:524093802-524521756
121            Executed_Gtid_Set: 30d1ce13-e8b0-43ae-b989-667aa0394fb8:1-240,
122f7123455-4085-4e24-a028-e0cff16d1cc6:1-8409014,
123f0c67103-9183-46c3-b34f-1b7fac7c0f51:1,
12417070e4d-a4bc-49b6-88d4-cbbc610abc2b:1,
125bb09bbce-c153-4af2-ab6f-85e70b74a13c:1-3,
126cc96b6de-d317-4881-9a86-9c9b690cb8cc:1-15,
127178dde0c-492c-4365-96e2-57008f2bd232:1-524521756,
128da0e0547-a1ca-4cae-8db9-f3a90b3a996a:1,
129134db0a3-61a4-4f96-8574-a3ec77045987:1-68821751
130                Auto_Position: 1
131         Replicate_Rewrite_DB: 
132                 Channel_Name: m2
133           Master_TLS_Version: 
1342 rows in set (0.00 sec)

多源复制(Multi-source replication)是指在一个数据库中从多个源数据库中复制数据到同一个目标数据库的过程。要在 MySQL 中实现多源复制,需要在目标数据库中创建多个复制通道(replication channel),每个通道对应一个源数据库。每个通道都需要有独立的复制配置,包括源数据库的连接信息、复制过滤规则等。

...

如何为MySQL 5.7 Group Replication集群中添加新节点

2017-03-04
Mysql

MySQL Group Replication(简称MGR)是MySQL 5.7引入的的一个新特性,是基于原生复制及paxos协议的组复制技术的高可用解决方案。 本文记录如何向MySQL 5.7 MGR集群(单主模式)中添加新节点的具体步骤,适用的场景包括: 添加新节点到集群中、迁移集群中的某个节点到另外一台服务器上。

...

© 2024 青蛙小白