西维蜀黍

【Redis】Codis 安装

Prerequisition

安装Go

$ echo "export GOPATH=/home/parallels/go" > .zshrc
$ echo "export GOROOT=/usr/lib/go-1.14" > .zshrc

安装Java

安装Zookeeper

安装 autoconf

$ sudo apt-get install autoconf
  ...


【Golang】Golang 安装

Ubuntu

If you’re using Ubuntu 18.04 LTS or 19.10 on amd64, arm64, armhf or i386, then you can use the longsleep/golang-backports PPA and install Go 1.14.

$ sudo add-apt-repository ppa:longsleep/golang-backports
$ sudo apt update
$ sudo apt install golang-go
  ...


【Prometheus】Prometheus - Exporter - Redis Exporter

Build and run locally

$ git clone https://github.com/oliver006/redis_exporter.git
$ cd redis_exporter
$ go build .
$ nohup /home/sw/redis_exporter/redis_exporter &
  ...


【Prometheus】Advanced

Concepts

Data Model

Metric and Label

Every time series is uniquely identified by its metric name and optional key-value pairs called labels.

The metric name specifies the general feature of a system that is measured (e.g. http_requests_total - the total number of HTTP requests received). It may contain ASCII letters and digits, as well as underscores and colons. It must match the regex [a-zA-Z_:][a-zA-Z0-9_:]*.

Note: The colons are reserved for user defined recording rules. They should not be used by exporters or direct instrumentation.

Labels enable Prometheus’s dimensional data model: any given combination of labels for the same metric name identifies a particular dimensional instantiation of that metric (for example: all HTTP requests that used the method POST to the /api/tracks handler). The query language allows filtering and aggregation based on these dimensions. Changing any label value, including adding or removing a label, will create a new time series.

Label names may contain ASCII letters, numbers, as well as underscores. They must match the regex [a-zA-Z_][a-zA-Z0-9_]*. Label names beginning with __ are reserved for internal use.

Label values may contain any Unicode characters.

A label with an empty label value is considered equivalent to a label that does not exist.

  ...


【Linux】安装 oh-my-zsh

$ sudo apt install git
$ sudo apt install zsh
$ chsh -s $(which zsh)
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Reference

  ...