西维蜀黍

【Kubernetes】cAdvisor

sdsd

  ...


【Kubernetes】学习

docker 在 Kubernetes 中的角色

Docker 技术依然执行它原本的任务。当 kubernetes 把 pod 调度到节点上,节点上的 kubelet 会指示 docker 启动特定的容器。接着,kubelet 会通过 docker 持续地收集容器的信息,然后提交到主节点上。Docker 如往常一样拉取容器镜像、启动或停止容器。不同点仅仅在于这是由自动化系统控制而非管理员在每个节点上手动操作的。

如果你曾经用过Docker容器技术部署容器,那么可以将Docker看成Kubernetes内部使用的低级别组件。Kubernetes不仅仅支持Docker,还支持Rocket,这是另一种容器技术。

docker仅能在单机上部署容器,而kubernetes可以统一管理各类容器,形成集群。Kubernetes作为Docker生态圈中重要一员,是Google多年大规模容器管理技术的开源版本。Kubernetes支持GCE、vShpere、CoreOS、Azure等平台,也可以直接运行在物理机上。

Kubernetes非常适合做微服务的架构。

其主要功能如下:

  1. 用户不需要关心需要多少台机器,只需要关心软件(服务)运行所需的环境。以服务为中心,你需要关心的是api,如何把大服务拆分成小服务,如何使用api去整合它们。

  2. 以集群的方式运行管理容器。

  3. 解决Docker跨机器容器之间的通讯问题。

  4. Kubernetes的Pods自我修复机制使得容器集群总是运行在用户指定的状态。

  ...


【Prometheus】Recording Rules

Recording Rules

Prometheus supports two types of rules which may be configured and then evaluated at regular intervals: recording rules and alerting rules. To include rules in Prometheus, create a file containing the necessary rule statements and have Prometheus load the file via the rule_files field in the Prometheus configuration. Rule files use YAML.

Recording rules allow you to precompute frequently needed or computationally expensive expressions and save their result as a new set of time series. Querying the precomputed result will then often be much faster than executing the original expression every time it is needed. This is especially useful for dashboards, which need to query the same expression repeatedly every time they refresh.

  ...


【Redis】How to Design Keys

Redis keys are binary safe, this means that you can use any binary sequence as a key, from a string like “foo” to the content of a JPEG file. The empty string is also a valid key.

A few other rules about keys:

  • Very long keys are not a good idea. For instance a key of 1024 bytes is a bad idea not only memory-wise, but also because the lookup of the key in the dataset may require several costly key-comparisons. Even when the task at hand is to match the existence of a large value, hashing it (for example with SHA1) is a better idea, especially from the perspective of memory and bandwidth.
  • Very short keys are often not a good idea. There is little point in writing “u1000flw” as a key if you can instead write “user:1000:followers”. The latter is more readable and the added space is minor compared to the space used by the key object itself and the value object. While short keys will obviously consume a bit less memory, your job is to find the right balance.
  • Try to stick with a schema. For instance “object-type:id” is a good idea, as in “user:1000”. Dots or dashes are often used for multi-word fields, as in comment:1234:reply.to or comment:1234:reply-to.
  • The maximum allowed key size is 512 MB.
  ...


【Redis】Pub/Sub

Publish/Subscribe Pattern

Refer to https://swsmile.info/post/publish-subscribe-pattern/

  ...