Kubernetes容器集群中的日志系统集成实践
|
Fig06-Elasticsearch的架构 ElasticSearch在Kubernetes中的部署架构我们在Kubernetes中,数据节点上面通过Kubernetes PVC绑定到相应的数据卷.PV的实际存储可以是NFS、GlusterFS等共享存储. Fig08-ElasticSearch与传统数据库的对比 ElasticSearch在Kubernetes集群中的部署在Kubernetes集群中部署ElasticSearch,我们会部署类似图中的3种节点:es-data类是用来存放索引数据的;es-master类是用来提供索引写服务的;es-client是用来提供索引查询服务的. Fig09-ElasticSearch在Kubernetes集群中的部署 ElasticSearch数据在Kubernetes集群中的持久化存储在部署es-data节点的时候,他们的数据卷我们是以共享存储卷挂载的,这里采用PVC/PV的模式挂载一个NFS的PV提供数据卷,如下图所示. Fig10-ElasticSearch数据在Kubernetes集群中的持久化存储 日志的备份和恢复ElasticSearch允许对于单个索引或整个集群做备份和恢复.备份恢复所支持的目标存储仓库类型包括: S3仓库:将AWS S3作为备份仓库 安装命令: sudo?bin/elasticsearch-plugin?install?repository-s3 创建仓库示例: PUT?_snapshot/my-s3-repository-1
{
"type":?"s3","settings":?{
"bucket":?"s3_repository_1","region":?"us-west"
}
}
Azure仓库:将Azure作为备份仓库 安装命令: sudo?bin/elasticsearch-plugin?install?repository-azure 创建仓库示例: PUT?_snapshot/my-azure-repository-1
{
"type":?"azure","settings":?{
????"container":?"backup-container",????"base_path":?"backups",????"chunk_size":?"32m",????"compress":?true
}
}
HDFS仓库:将HDFS作为备份仓库 安装命令: sudo?bin/elasticsearch-plugin?install?repository-hdfs 创建仓库示例: PUT?_snapshot/my-hdfs-repository-1
{
"type":?"hdfs","settings":?{
"uri":?"hdfs://namenode:8020/","path":?"elasticsearch/respositories/my_hdfs_repository","conf.dfs.client.read.shortcircuit":?"true"
}
}
GCS仓库:将Google Cloud Storage作为备份仓库 安装命令: sudo?bin/elasticsearch-plugin?install?repository-gcs 创建仓库示例: PUT?_snapshot/my-gcs-repository-1
{
"type":?"gcs","settings":?{
"bucket":?"my_bucket","service_account":?"_default_"
}
}
作为私有云部署的环境,多数基于OpenStack的IaaS层,可以采用OpenStack的对象存储Swift作为备份. Swift仓库:将OpenStack Swift作为备份仓库 安装命令: sudo?bin/elasticsearch-plugin?install?org.wikimedia.elasticsearch.swift/swift-repository-plugin/2.1.1
创建仓库示例:
PUT?_snapshot/my-gcs-repository-1
{
"type":?"swift","settings":?{
????"swift_url":?"http://localhost:8080/auth/v1.0/",????"swift_container":?"my-container",????"swift_username":?"myuser",????"swift_password":?"mypass!"
}
}
选用ElasticSearch的理由:
Kibana在Kubernetes中的部署Kibana跟ElasticSearch的集成相对来说比较直观,利用https://hub.docker.com/r/fabric8/kibana4/镜像,设置好ELASTICSEARCH_URL参数就可以,Kibana是一个部署在Kubernetes集群中的Web前端服务,而它引用ELASTICSEARCH_URL这个环境变量作为资源使用. 整体日志管理系统的架构在Kubernetes集群中的每个节点上运行一个Fluentd的容器,收集容器的日志发送给到ElasticSearch集群中.ElasticSearch集群会保存一周的日志作为热数据以供实时分析和查询,用户可以通过Kibana查看任意Node、Namespace、Service、Pod和容器的数据.对于超过一周的日志数据,ElasticSearch会自动备份到Swift对象存储的相应Bucket中. Fig12-整体Kubernetes日志管理系统的架构 Q:请问Kubernetes宿主机的日志是如何收集的?
(编辑:网站开发网_盐城站长网 ) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |

