Kubernetes容器集群中的日志系统集成实践
创建仓库示例: 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宿主机的日志是如何收集的?
Q:如果把移动设备的整机日志输入系统,尤其是移动设备需要注意哪些问题?产生日志目前想到有两种方案:(1)使用APP转发给Fluentd(2)使用Syslog,个人感觉第二个更合适,或者还有其他更好的方案么?
|