DockerでPrometheusをインストールする詳細なチュートリアル

DockerでPrometheusをインストールする詳細なチュートリアル

Docker デプロイメント Prometheus の手順:

監視端末設置:
Prometheus サーバー (Prometheus 監視メイン サーバー)
ノード エクスポータ (ホスト ハードウェアとオペレーティング システム情報を収集)
cAdvisor (ホスト上で実行されているコンテナに関する情報を収集する役割を担う)
Grafana (Prometheus 監視インターフェースを表示)

監視対象インストール:
ノード エクスポータ (ホスト ハードウェアとオペレーティング システム情報を収集)
cAdvisor (ホスト上で実行されているコンテナに関する情報を収集する役割を担う)

1. Node Exporterをインストールする

  • すべてのサーバーのインストール
  • Node Exporter はシステム情報を収集し、CPU、メモリ、ディスク使用量、ディスクの読み取りと書き込みなどのシステム情報を監視するために使用されます。
  • –net=host、これによりPrometheusサーバーはNode Exporterと直接通信できるようになります。
docker run -d -p 9100:9100 \
-v "/proc:/host/proc" \
-v "/sys:/host/sys" \
-v "/:/rootfs" \
-v "/etc/localtime:/etc/localtime" \
--net=ホスト\
prom/ノードエクスポーター \
--path.procfs /ホスト/proc \
--path.sysfs /ホスト/sys \
--collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"

[root@k8s-m1 ~]# docker ps|grep エクスポーター
ee30add8d207 prom/node-exporter "/bin/node_exporter …" 約 1 分前 約 1 分前 condescending_shirley

2. cAdvisorをインストールする

  • すべてのサーバーのインストール
  • cAdvisorはdocker情報を収集し、dockerのCPU、メモリ、アップロード、ダウンロード情報を表示します。
  • –net=host、これによりPrometheusサーバーはcAdvisorと直接通信できるようになります。
docker run -d \
-v "/etc/localtime:/etc/localtime" \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/dev/disk/:/dev/disk:ro \
--publish=18104:8080 \
--detach=true \
--name=cadvisor \
--privileged=true \
google/cadvisor:最新

[root@k8s-m1 ~]# docker ps|grep cadvisor
cf6af6118055 google/cadvisor:latest "/usr/bin/cadvisor -…" 38 秒前 37 秒前にアップ 0.0.0.0:18104->8080/tcp cadvisor
コンテナに入ると次のものが表示されます:
[root@agent ~]# sudo docker exec -it コンテナID /bin/sh

3. Prometheusサーバーをインストールする

監視端末設置

1) 設定ファイルを編集する

  • まず、ローカルで prometheus.yml を作成します。これは Prometheus の設定ファイルです。
  • 次の内容をファイルに書き込む
  • リスニングアドレスを自分のローカルアドレスに変更する
# 私のグローバル設定
グローバル:
  scrape_interval: 15s # スクレイプ間隔を 15 秒ごとに設定します。デフォルトは 1 分ごとです。
  evaluation_interval: 15s # 15 秒ごとにルールを評価します。デフォルトは 1 分ごとです。
  # scrape_timeout はグローバルデフォルト (10 秒) に設定されています。

# アラートマネージャの設定
警告:
  アラートマネージャー:
  - 静的設定:
    - ターゲット:
      # - アラートマネージャー:9093

# ルールを一度読み込み、グローバル 'evaluation_interval' に従って定期的に評価します。
ルールファイル:
  # - "first_rules.yml"
  # - "second_rules.yml"

# スクレイピングするエンドポイントを 1 つだけ含むスクレイピング設定:
# ここでは Prometheus そのもの。
scrape_configs:
  # ジョブ名は、この設定から取得されたすべての時系列にラベル `job=<job_name>` として追加されます。
  - ジョブ名: 'プロメテウス'

    # metrics_path のデフォルトは '/metrics' です
    # スキームのデフォルトは 'http' です。

    静的設定:
    #リスニングアドレス - ターゲット: ['localhost:9090','172.23.0.241:8088','172.23.0.241:9090']

2) コンテナを起動する

1> prometheus.yml 設定ファイル

外部ネットワーク IP は prometheus.yml で設定する必要があります。内部ネットワーク IP は、ローカル マシンを除いて Grafana では認識されません。

# 私のグローバル設定
グローバル:
  scrape_interval: 15s # スクレイプ間隔を 15 秒ごとに設定します。デフォルトは 1 分ごとです。
  evaluation_interval: 15s # 15 秒ごとにルールを評価します。デフォルトは 1 分ごとです。
  # scrape_timeout はグローバルデフォルト (10 秒) に設定されています。

# アラートマネージャの設定
警告:
  アラートマネージャー:
  - 静的設定:
    - ターゲット:
      # - アラートマネージャー:9093

# ルールを一度読み込み、グローバル 'evaluation_interval' に従って定期的に評価します。
ルールファイル:
  # - "first_rules.yml"
  # - "second_rules.yml"

# スクレイピングするエンドポイントを 1 つだけ含むスクレイピング設定:
# ここでは Prometheus そのもの。
scrape_configs:
  # ジョブ名は、この設定から取得されたすべての時系列にラベル `job=<job_name>` として追加されます。
  - ジョブ名: 'プロメテウス'

    # metrics_path のデフォルトは '/metrics' です
    # スキームのデフォルトは 'http' です。

    静的設定:
    #リスニング アドレス (サーバーのイントラネット IP です)
    - ターゲット: ['10.27.158.33:9090','10.27.158.33:9100','10.27.158.33:18104']
    - ターゲット: ['10.29.46.54:9100','10.29.46.54:18104']
    - ターゲット: ['10.27.163.172:9100','10.27.163.172:18104']

# - ジョブ名: 'GitLab'
# metrics_path: '/-/metrics'
# 静的設定:
# - ターゲット: ['172.23.0.241:10101']

  - ジョブ名: 'jenkins'
    メトリックパス: '/prometheus/'
    スキーム: http
    ベアラートークン: ベアラートークン
    静的設定:
    - ターゲット: ['172.23.0.242:8080']

  - ジョブ名: "Nginx"
    メトリックスパス: '/status/format/prometheus'
    静的設定:
    - ターゲット: ['172.23.0.242:8088']

2>開始コマンド

–net=host、これによりPrometheusサーバーはExporterおよびGrafanaと直接通信できるようになります。

docker run -d -p 9090:9090 \
ディレクトリ名: Prometheus ディレクトリのパス名
-v "/etc/localtime:/etc/localtime" \
--name プロメテウス \
--net=ホスト\
prom/プロメテウス:最新

# Prometheus コンテナが正常に起動した後のアクセス# PS: ブラウザを使用して 9090 0.0.0.0 にアクセスする前に、サーバーは eth0 の外部ネットワーク ポートを開く必要があります。
106.15.0.11:9090

4. Grafanaを作成して実行する

  • 監視サーバーのインストール
  • グラフィック表示用
docker run -d -i -p 3000:3000 \
-v "/etc/localtime:/etc/localtime" \
-e "GF_SERVER_ROOT_URL=http://grafana.server.name" \
-e "GF_SECURITY_ADMIN_PASSWORD=admin8888" \
--net=ホスト\
グラファナ/グラファナ

# PS: ブラウザでアクセスする前に、サーバーは eth0 の外部ネットワーク ポートを開く必要があります: 3000 0.0.0.0
Grafana が起動したら、ブラウザで 172.23.0.241:3000 ログイン インターフェイスを開き、ログインします。
	ユーザー名: admin
	パスワード: admin8888

1) Prometheusサーバーを追加する

ここに画像の説明を挿入
ここに画像の説明を挿入
ここに画像の説明を挿入
ここに画像の説明を挿入

次に、追加したデータソースをグラフィカルに表示します。

ここに画像の説明を挿入
ここに画像の説明を挿入
ここに画像の説明を挿入

5. 監視テンプレートを追加する

  • ダッシュボードを手動で作成するのは少し難しいです。Kaiyuan の力を利用して [監視テンプレートのアドレス] https://grafana.com/grafana/dashboards にアクセスすると、Docker を監視するためのダッシュボードが多数表示されます。監視テンプレートのアドレス(必要に応じて複数の監視テンプレートをダウンロードできます)
  • 監視テンプレートアドレス
  • 一部のダッシュボードはダウンロード後すぐにインポートできますが、他のダッシュボードはインポート前に変更する必要があります。ダッシュボードの概要を確認する必要があります。
  • 最終的な効果

ここに画像の説明を挿入

この時点で、対応するテンプレートをコンパイルし、Prometheus から値を取得して Grafana に転送することを選択できます。それでおしまい。とても便利です!

6. キー値クエリ

インジケーター io_namespace_http_requests_total を通じて次のことが可能になります。

アプリケーションの合計リクエスト数を照会する sum(io_namespace_http_requests_total)
1秒あたりのHTTPリクエスト数を照会する sum(rate(io_wise2c_gateway_requests_total[5m]))
現在のアプリケーションリクエストの上位N個のURIを照会する
	topk(10、io_namespace_http_requests_total の合計、パスによる)

Nginxを監視するためにPrometheusを設定する

1. Prometheusを監視に使用する前に、Nginxに2つのモジュールをインストールする必要があります: nginx-module-vts、geoip

2. アイデア: コンパイルしても、yum でインストールしても、同じバージョンの tar パッケージをダウンロードする必要があります。元のインストール オプションに基づいて、上記の 2 つのモジュール オプションを追加し、コンパイルしてインストールして元の nginx を置き換え、最後に元の nginx ディレクトリの設定ファイル (nginx.conf ファイルや conf.d ディレクトリなど) をコンパイルしてインストールした nignx ディレクトリに移動し、最後に nginx を起動します。

公式ソースのインストールは次のとおりです。
1) 公式ソースを設定する

[root@web01 ~]# vim /etc/yum.repos.d/nginx.repo
[nginx-安定版]
name=nginx 安定リポジトリ
ベースURL=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=1
有効=1
gpgkey=https://nginx.org/keys/nginx_signing.key
モジュール_hotfixes=true

2) 依存関係をインストールする

yum install -y gcc gcc-c++ autoconf pcre pcre-devel make automake wget httpd-tools vim ツリー

3) nginxをインストールする

[root@web01 ~]# yum install -y nginx

4) nginxを設定する

[root@web01 ~]# vim /etc/nginx/nginx.conf
ユーザー www;

5) サービスを開始する

1. 方法1: 直接起動します。エラーがある場合 ==》重大なエラー、ポート80が占有されています ==》ポートを占有しているサービスHTTPDを確認し、停止してnginxを再起動します
[root@web01 ~]# systemctl nginxを起動します
2. 方法2:
[root@web01 ~]# nginx

1. 現在のNginxインストールオプションを表示する

[root@db01 nginx-1.12.2]# nginx -V
[root@db01 nginx-1.12.2]# ./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-compat --with-debug --with-file-aio --with-google_perftools_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'

2. モジュールを準備する

# 新しいパッケージをダウンロードして解凍します [root@k8s-n1 パッケージ]# wget http://nginx.org/download/nginx-1.16.1.tar.gz
[root@k8s-n1 パッケージ]# tar xf nginx-1.16.1.tar.gz

# nginx-module-vts モジュール [root@k8s-n1 パッケージ] をクローンしてダウンロードします。# git clone https://github.com/vozlt/nginx-module-vts

# .GeoIP モジュールをインストールします [root@k8s-n1 パッケージ]# yum -y install epel-release geoip-devel

3. Nginxサービスを停止する

# nginx サービスを停止します [root@k8s-n1 パッケージ]# nginx -s stop

#元のnginx起動ファイルをバックアップする[root@k8s-n1パッケージ]# which nginx
nginx のディレクトリは /usr/sbin/nginx です。
[root@k8s-n1 パッケージ]# mv /usr/sbin/nginx /usr/sbin/nginx.bak

# 元のnignxディレクトリをバックアップします [root@k8s-n1 パッケージ]# mv /etc/nginx nginx-1.12.2.bak

4. コンパイルしてインストールする

1> 必要な依存関係をインストールする

コンパイルおよびインストール時に、「make: *** No rule to create target 'build' required by 'default'」というエラーが表示される場合があります。 stop` のエラーは依存関係の不足が原因です。# とにかくインストールしてからコンパイルしてください。そうしないと、依存関係をインストールした後に再度 ./configure を実行する必要があります。~
yum install -y gcc gcc++ bash-completion vim lrzsz wget expect net-tools nc nmap tree dos2unix htop iftop iotop unzip telnet sl psmisc nethogs glances bc pcre-devel zlib zlib-devel openssl openssl-devel libxml2 libxml2-dev libxslt-devel gd gd-devel perl-devel perl-ExtUtils-Embed GeoIP GeoIP-devel GeoIP-data pcre-devel

2> コンパイルしてインストールする

  • 解凍したnginxディレクトリに入り、コンパイルしてインストールします
  • 元のインストールパラメータに基づいて、最後に2つのパラメータを追加します

–add-module=/root/packages/nginx-module-vts
--http_geoip_module を使う

[root@db01 nginx-1.12.2]# ./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-compat --with-debug --with-file-aio --with-google_perftools_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' --add-module=/root/package/nginx-module-vts --with-http_geoip_module
# コンパイルしてインストール# -j マルチコアコンパイル (低設定ではこのパラメータの使用は推奨されません。スタックしてしまいます~)
[root@k8s-n1 nginx-1.12.2]# make -j && make install

5. Nginxを設定する

[root@k8s-n1 パッケージ]# cp -r nginx-1.12.2.bak/conf.d/ /etc/nginx/
[root@k8s-n1 パッケージ]# cp -r nginx-1.12.2.bak/nginx.conf /etc/nginx/
[root@k8s-n1 パッケージ]# rm -f /etc/nginx/conf.d/default.conf

Nginx 設定ファイルを構成する

HTTP レイヤー

サーバー層

	···
http {	
	···
    /etc/nginx/conf.d/*.conf を含めます。

	##################### 1.http レイヤー: 3 行の設定を追加します###################### 
    vhost_traffic_status_zone;
    vhost_traffic_status_filter_by_host がオン;
    geoip_country /usr/share/GeoIP/GeoIP.dat;

	##################### 2. サーバー層: サーバー層のポート番号を指定します。ポート 8088 が推奨されます。競合がない場合は、コピーして貼り付けるだけです。########################
    サーバー{
        聞く 8088;
        server_name ローカルホスト;
        # 次の vhost 設定はこの場所に書き込まれます location /status {
        vhost_traffic_status on; # トラフィックステータス、デフォルトはオン、この行は省略可能 vhost_traffic_status_display;
        vhost_traffic_status_display_format html;
        vhost_traffic_status_filter_by_set_key $uri uri::$server_name; # URI ごとの訪問数 vhost_traffic_status_filter_by_set_key $geoip_country_code country::$server_name; # 国/地域ごとのリクエスト数 vhost_traffic_status_filter_by_set_key $status $server_name; # http コード統計 vhost_traffic_status_filter_by_set_key $upstream_addr upstream::backend; # バックエンド > 転送統計 vhost_traffic_status_filter_by_set_key $remote_port client::ports::$server_name; # リクエスト ポート統計 vhost_traffic_status_filter_by_set_key $remote_addr client::addr::$server_name; # リクエスト IP 統計の場所 ~ ^/storage/(.+)/.*$ {
            $volumeを$1に設定します。
            vhost_traffic_status_filter_by_set_key $volume storage::$server_name; #リクエストパス統計}
        }
    }
   	####################### サーバー層: 新しいサーバーを作成したり、元の構成を変更したりできます#######################
}

6. Nginxを起動する

[root@k8s-n1 パッケージ]# nginx
[root@k8s-n1 パッケージ]# netstat -lntp|grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 62214/nginx: マスター 
tcp 0 0 0.0.0.0:8088 0.0.0.0:* LISTEN 62214/nginx: マスター 

ブラウザアクセス:
	172.23.0.243:80 # nginx デフォルト公式ページ 172.23.0.243:8088/status # nignx 監視項目ページ

ここに画像の説明を挿入

7. Prometheusによる監視

  • Prometheusサーバーでprometheus.ymlを設定し、Prometheusコンテナを再起動します。
  • metrics_path: インターフェースのサフィックスタイプを定義します。デフォルトは /metrics です。
  • つまり、IP+ポートを入力すると、ブラウザは自動的に/metricsサフィックスを追加します。
[root@k8s-m1 ~]# vim prometheus.yml
···
scrape_configs:
  - ジョブ名: "Nginx"
    メトリックスパス: '/status/format/prometheus'
    静的設定:
    - ターゲット: ['172.23.0.243:8088']
···
[root@k8s-m1 ~]# docker で prometheus を再起動します

# このとき、Prometheus 管理ページに入り、nginx の監視項目を照会します。

8. 各モニタリング項目の意味

Nginx-module-vts はさまざまな監視項目を提供します。監視項目の意味を理解することで、必要なチャートを生成するのに役立ちます。

# ヘルプ nginx_vts_info Nginx 情報
# タイプ nginx_vts_info ゲージ
nginx_vts_info{ホスト名="hbhly_21_205",バージョン="1.16.1"} 1
# ヘルプ nginx_vts_start_time_seconds Nginx の起動時間
# タイプ nginx_vts_start_time_seconds ゲージ
nginx_vts_start_time_seconds 1584268136.439
# ヘルプ nginx_vts_main_connections Nginx 接続
# タイプ nginx_vts_main_connections ゲージ

# ステータス別の nginx 接続数 nginx_vts_main_connections{status="accepted"} 9271
nginx_vts_main_connections{ステータス="アクティブ"} 7
nginx_vts_main_connections{ステータス="処理済み"} 9271
nginx_vts_main_connections{ステータス="読み取り中"} 0
nginx_vts_main_connections{ステータス="リクエスト"} 438850
nginx_vts_main_connections{ステータス="待機中"} 6
nginx_vts_main_connections{ステータス="書き込み中"} 1
# ヘルプ nginx_vts_main_shm_usage_bytes 共有メモリ [ngx_http_vhost_traffic_status] 情報
# タイプ nginx_vts_main_shm_usage_bytes ゲージ

# メモリ使用量 nginx_vts_main_shm_usage_bytes{shared="max_size"} 1048575
nginx_vts_main_shm_usage_bytes{共有="使用サイズ"} 24689
nginx_vts_main_shm_usage_bytes{shared="used_node"} 7
# HELP nginx_vts_server_bytes_total リクエスト/レスポンスバイト数
# タイプ nginx_vts_server_bytes_total カウンター
# HELP nginx_vts_server_requests_total リクエストカウンタ
# タイプ nginx_vts_server_requests_total カウンター
# HELP nginx_vts_server_request_seconds_total リクエストの処理時間(秒)
# タイプ nginx_vts_server_request_seconds_total カウンター
# HELP nginx_vts_server_request_seconds リクエスト処理時間の平均(秒単位)
# タイプ nginx_vts_server_request_seconds ゲージ
# HELP nginx_vts_server_request_duration_seconds リクエスト処理時間のヒストグラム
# タイプ nginx_vts_server_request_duration_seconds ヒストグラム
# HELP nginx_vts_server_cache_total リクエストキャッシュカウンタ
# タイプ nginx_vts_server_cache_total カウンター

# ホストの入出力トラフィック nginx_vts_server_bytes_total{host="10.160.21.205",direction="in"} 22921464
nginx_vts_server_bytes_total{ホスト="10.160.21.205",方向="out"} 1098196005

# ステータスコード別のリクエスト数 1** 2** 3** 4** 5**
nginx_vts_server_requests_total{ホスト="10.160.21.205",コード="1xx"} 0
nginx_vts_server_requests_total{ホスト="10.160.21.205",コード="2xx"} 86809
nginx_vts_server_requests_total{ホスト="10.160.21.205",コード="3xx"} 0
nginx_vts_server_requests_total{ホスト="10.160.21.205",コード="4xx"} 2
nginx_vts_server_requests_total{ホスト="10.160.21.205",コード="5xx"} 0
nginx_vts_server_requests_total{ホスト="10.160.21.205",コード="合計"} 86811

# 応答時間 nginx_vts_server_request_seconds_total{host="10.160.21.205"} 0.000
nginx_vts_server_request_seconds{ホスト="10.160.21.205"} 0.000

#ステータス別のキャッシュの統計 nginx_vts_server_cache_total{host="10.160.21.205",status="miss"} 0
nginx_vts_server_cache_total{ホスト="10.160.21.205",ステータス="バイパス"} 0
nginx_vts_server_cache_total{ホスト="10.160.21.205",ステータス="期限切れ"} 0
nginx_vts_server_cache_total{ホスト="10.160.21.205",ステータス="古い"} 0
nginx_vts_server_cache_total{ホスト="10.160.21.205",ステータス="更新中"} 0
nginx_vts_server_cache_total{ホスト="10.160.21.205",ステータス="再検証済み"} 0
nginx_vts_server_cache_total{ホスト="10.160.21.205",ステータス="ヒット"} 0
nginx_vts_server_cache_total{host="10.160.21.205",status="不足"} 0
nginx_vts_server_bytes_total{ホスト="devapi.feedback.test",方向="in"} 3044526
nginx_vts_server_bytes_total{ホスト="devapi.feedback.test",方向="out"} 41257028

# 状態別の接続数の統計 nginx_vts_server_requests_total{host="devapi.feedback.test",code="1xx"} 0
nginx_vts_server_requests_total{ホスト="devapi.feedback.test",コード="2xx"} 3983
nginx_vts_server_requests_total{ホスト="devapi.feedback.test",コード="3xx"} 0
nginx_vts_server_requests_total{ホスト="devapi.feedback.test",コード="4xx"} 24
nginx_vts_server_requests_total{ホスト="devapi.feedback.test",コード="5xx"} 11
nginx_vts_server_requests_total{ホスト="devapi.feedback.test",コード="total"} 4018
nginx_vts_server_request_seconds_total{ホスト="devapi.feedback.test"} 327.173
nginx_vts_server_request_seconds{host="devapi.feedback.test"} 0.000

# nginx キャッシュ計算機、ステータスとタイプを正確に計算
nginx_vts_server_cache_total{ホスト="devapi.feedback.test",ステータス="miss"} 0
nginx_vts_server_cache_total{ホスト="devapi.feedback.test",ステータス="バイパス"} 0
nginx_vts_server_cache_total{ホスト="devapi.feedback.test",ステータス="期限切れ"} 0
nginx_vts_server_cache_total{host="devapi.feedback.test",status="stale"} 0
nginx_vts_server_cache_total{ホスト="devapi.feedback.test",ステータス="更新中"} 0
nginx_vts_server_cache_total{ホスト="devapi.feedback.test",ステータス="再検証済み"} 0
nginx_vts_server_cache_total{ホスト="devapi.feedback.test",ステータス="ヒット"} 0
nginx_vts_server_cache_total{host="devapi.feedback.test",status="scarce"} 0
nginx_vts_server_bytes_total{host="testapi.feedback.test",direction="in"} 55553573
nginx_vts_server_bytes_total{host="testapi.feedback.test",direction="out"} 9667561188
nginx_vts_server_requests_total{ホスト="testapi.feedback.test",コード="1xx"} 0
nginx_vts_server_requests_total{ホスト="testapi.feedback.test",コード="2xx"} 347949
nginx_vts_server_requests_total{ホスト="testapi.feedback.test",コード="3xx"} 31
nginx_vts_server_requests_total{ホスト="testapi.feedback.test",コード="4xx"} 7
nginx_vts_server_requests_total{ホスト="testapi.feedback.test",コード="5xx"} 33
nginx_vts_server_requests_total{host="testapi.feedback.test",code="total"} 348020
nginx_vts_server_request_seconds_total{host="testapi.feedback.test"} 2185.177
nginx_vts_server_request_seconds{host="testapi.feedback.test"} 0.001
nginx_vts_server_cache_total{host="testapi.feedback.test",status="miss"} 0
nginx_vts_server_cache_total{ホスト="testapi.feedback.test",ステータス="バイパス"} 0
nginx_vts_server_cache_total{ホスト="testapi.feedback.test",ステータス="期限切れ"} 0
nginx_vts_server_cache_total{host="testapi.feedback.test",status="stale"} 0
nginx_vts_server_cache_total{ホスト="testapi.feedback.test",ステータス="更新中"} 0
nginx_vts_server_cache_total{host="testapi.feedback.test",ステータス="再検証済み"} 0
nginx_vts_server_cache_total{ホスト="testapi.feedback.test",ステータス="ヒット"} 0
nginx_vts_server_cache_total{host="testapi.feedback.test",status="scarce"} 0
nginx_vts_server_bytes_total{host="*",direction="in"} 81519563
nginx_vts_server_bytes_total{ホスト="*",方向="out"} 10807014221

# ホスト別のリクエスト統計 nginx_vts_server_requests_total{host="*",code="1xx"} 0
nginx_vts_server_requests_total{ホスト="*",コード="2xx"} 438741
nginx_vts_server_requests_total{ホスト="*",コード="3xx"} 31
nginx_vts_server_requests_total{ホスト="*",コード="4xx"} 33
nginx_vts_server_requests_total{ホスト="*",コード="5xx"} 44
nginx_vts_server_requests_total{host="*",code="total"} 438849
nginx_vts_server_request_seconds_total{ホスト="*"} 2512.350
nginx_vts_server_request_seconds{ホスト="*"} 0.007

# ホストキャッシュ統計 nginx_vts_server_cache_total{host="*",status="miss"} 0
nginx_vts_server_cache_total{ホスト="*",ステータス="バイパス"} 0
nginx_vts_server_cache_total{ホスト="*",ステータス="期限切れ"} 0
nginx_vts_server_cache_total{host="*",status="stale"} 0
nginx_vts_server_cache_total{ホスト="*",ステータス="更新中"} 0
nginx_vts_server_cache_total{host="*",status="再検証済み"} 0
nginx_vts_server_cache_total{ホスト="*",ステータス="ヒット"} 0
nginx_vts_server_cache_total{host="*",status="scarce"} 0
# HELP nginx_vts_upstream_bytes_total リクエスト/レスポンスバイト数
# タイプ nginx_vts_upstream_bytes_total カウンター
# HELP nginx_vts_upstream_requests_total アップストリームリクエストカウンタ
# タイプ nginx_vts_upstream_requests_total カウンター
# HELP nginx_vts_upstream_request_seconds_total アップストリームを含むリクエストの処理時間(秒単位)
# タイプ nginx_vts_upstream_request_seconds_total カウンター
# HELP nginx_vts_upstream_request_seconds アップストリームを含むリクエスト処理時間の平均(秒単位)
# タイプ nginx_vts_upstream_request_seconds ゲージ
# HELP nginx_vts_upstream_response_seconds_total 秒単位のアップストリーム応答処理時間のみ
# タイプ nginx_vts_upstream_response_seconds_total カウンター
# HELP nginx_vts_upstream_response_seconds アップストリーム応答処理時間のみの平均(秒単位)
# タイプ nginx_vts_upstream_response_seconds ゲージ
# HELP nginx_vts_upstream_request_duration_seconds アップストリームを含むリクエスト処理時間のヒストグラム
# タイプ nginx_vts_upstream_request_duration_seconds ヒストグラム
# HELP nginx_vts_upstream_response_duration_seconds アップストリームレスポンス処理時間のみのヒストグラム
# タイプ nginx_vts_upstream_response_duration_seconds ヒストグラム

# アップストリームトラフィック統計 nginx_vts_upstream_bytes_total{upstream="::nogroups",backend="10.144.227.162:80",direction="in"} 12296
nginx_vts_upstream_bytes_total{アップストリーム="::nogroups",バックエンド="10.144.227.162:80",方向="out"} 13582924
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.144.227.162:80",コード="1xx"} 0
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.144.227.162:80",コード="2xx"} 25
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.144.227.162:80",コード="3xx"} 0
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.144.227.162:80",コード="4xx"} 0
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.144.227.162:80",コード="5xx"} 0
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.144.227.162:80",コード="total"} 25
nginx_vts_upstream_request_seconds_total{アップストリーム="::nogroups",バックエンド="10.144.227.162:80"} 1.483
nginx_vts_upstream_request_seconds{アップストリーム="::nogroups",バックエンド="10.144.227.162:80"} 0.000
nginx_vts_upstream_response_seconds_total{アップストリーム="::nogroups",バックエンド="10.144.227.162:80"} 1.484
nginx_vts_upstream_response_seconds{アップストリーム="::nogroups",バックエンド="10.144.227.162:80"} 0.000
nginx_vts_upstream_bytes_total{アップストリーム="::nogroups",バックエンド="10.152.218.149:80",方向="in"} 12471
nginx_vts_upstream_bytes_total{アップストリーム="::nogroups",バックエンド="10.152.218.149:80",方向="out"} 11790508
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.152.218.149:80",コード="1xx"} 0
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.152.218.149:80",コード="2xx"} 24
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.152.218.149:80",コード="3xx"} 0
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.152.218.149:80",コード="4xx"} 0
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.152.218.149:80",コード="5xx"} 0
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.152.218.149:80",コード="total"} 24
nginx_vts_upstream_request_seconds_total{アップストリーム="::nogroups",バックエンド="10.152.218.149:80"} 1.169
nginx_vts_upstream_request_seconds{アップストリーム="::nogroups",バックエンド="10.152.218.149:80"} 0.000
nginx_vts_upstream_response_seconds_total{アップストリーム="::nogroups",バックエンド="10.152.218.149:80"} 1.168
nginx_vts_upstream_response_seconds{アップストリーム="::nogroups",バックエンド="10.152.218.149:80"} 0.000
nginx_vts_upstream_bytes_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8081",方向="in"} 3036924
nginx_vts_upstream_bytes_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8081",方向="out"} 33355357
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8081",コード="1xx"} 0
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8081",コード="2xx"} 3971
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8081",コード="3xx"} 0
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8081",コード="4xx"} 24
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8081",コード="5xx"} 11
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8081",コード="total"} 4006
nginx_vts_upstream_request_seconds_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8081"} 326.427
nginx_vts_upstream_request_seconds{アップストリーム="::nogroups",バックエンド="10.160.21.205:8081"} 0.000
nginx_vts_upstream_response_seconds_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8081"} 300.722
nginx_vts_upstream_response_seconds{アップストリーム="::nogroups",バックエンド="10.160.21.205:8081"} 0.000
nginx_vts_upstream_bytes_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8082",方向="in"} 55536408
nginx_vts_upstream_bytes_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8082",方向="out"} 9650089427
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8082",コード="1xx"} 0
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8082",コード="2xx"} 347912
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8082",コード="3xx"} 31
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8082",コード="4xx"} 7
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8082",コード="5xx"} 33
nginx_vts_upstream_requests_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8082",コード="total"} 347983
nginx_vts_upstream_request_seconds_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8082"} 2183.271
nginx_vts_upstream_request_seconds{アップストリーム="::nogroups",バックエンド="10.160.21.205:8082"} 0.001
nginx_vts_upstream_response_seconds_total{アップストリーム="::nogroups",バックエンド="10.160.21.205:8082"} 2180.893
nginx_vts_upstream_response_seconds{アップストリーム="::nogroups",バックエンド="10.160.21.205:8082"} 0.001

9. Prometheus UIでのターゲット式クエリ

1) CAdvisorから得られる典型的なモニタリング指標

指標名タイプ意味
コンテナ_CPU_負荷_平均_10秒ゲージ過去 10 秒間のコンテナの平均 CPU 負荷
コンテナCPU使用時間合計秒数カウンタ各 CPU コアのコンテナの累積使用時間 (秒単位)
コンテナCPUシステム合計秒数カウンタシステムCPU累積使用時間(単位:秒)
コンテナ_CPU_ユーザー_秒数_合計カウンタユーザーのCPU累積使用時間(単位:秒)
コンテナ_fs_usge_bytesゲージコンテナ内のファイルシステム使用量(バイト単位)
コンテナネットワーク受信バイト合計カウンタコンテナネットワークが受信したデータの合計量(単位:バイト)
コンテナネットワーク送信バイト合計カウンタコンテナネットワークで転送されたデータの総量(単位:バイト)

2) コンテナ関連

# コンテナのCPU使用率 sum(irate(container_cpu_usage_seconds_total{image!=""}[1m])) (cpu)なし

# コンテナのメモリ使用量(単位:バイト)
コンテナメモリ使用量バイト{画像!=""}

# コンテナネットワーク受信速度(単位:バイト/秒)
sum(rate(container_network_receive_bytes_total{image!=""}[1m])) (インターフェースなし)

# コンテナネットワーク転送速度 sum(rate(container_network_transmit_bytes_total{image!=""}[1m])) (インターフェースなし)

# コンテナファイルシステムの読み取り速度 sum(rate(container_fs_reads_bytes_total{image!=""}[1m])) (デバイスなし)

# コンテナファイルシステムの書き込み速度(単位:バイト/秒)
sum(rate(container_fs_writes_bytes_total{image!=""}[1m])) (デバイスなし)

3) HTTP関連

# HTTPリクエストの総数 prometheus_http_requests_total

#HTTP リクエスト期間秒数バケット prometheus_http_request_duration_seconds_bucket

# HTTP リクエストの継続時間(秒単位) prometheus_http_request_duration_seconds_count

# HTTP リクエストの継続時間の合計(秒単位) prometheus_http_request_duration_seconds_sum

# HTTP レスポンスサイズ(バイト単位) prometheus_http_response_size_bytes_bucket

# HTTP レスポンスのサイズ バイト数 count prometheus_http_response_size_bytes_count

# HTTPレスポンスサイズの合計バイト数 prometheus_http_response_size_bytes_sum

4) Nginx関連

# Nginxvts フィルターバイト合計 nginx_vts_filter_bytes_total

# Nginx VTS フィルターキャッシュの合計 nginx_vts_filter_cache_total

# Nginx VTS フィルターリクエスト秒数 nginx_vts_filter_request_seconds

# Nginx VTS フィルターリクエストの合計秒数 nginx_vts_filter_request_seconds_total

# Nginx VTS フィルターリクエストの総数 nginx_vts_filter_requests_total

# nginx 情報 nginx_vts_info

# Nginx VTS メイン接続 nginx_vts_main_connections

# Nginx VTS メイン SHM 使用バイト nginx_vts_main_shm_usage_bytes

# Nginx VTS サーバーの合計バイト数 nginx_vts_server_bytes_total

# Nginx VTS サーバー キャッシュの合計 nginx_vts_server_cache_total

# Nginx_vts サーバーリクエスト秒数 nginx_vts_server_request_seconds

# Nginx_vts サーバーリクエストの合計秒数 nginx_vts_server_request_seconds_total

#NGINX_VTSサービスの総数NGINX_VTS_SERVER_REQUESTS_TOTAL

#nginx vts秒単位の開始時間nginx_vts_start_time_seconds

10。BlackBox_Exporterをインストールします

  • Blackboxは、サービスHTTPリクエストが200を返すかどうかを判断してからアラージングするなど、サービスステータス情報を収集します
  • Blackbox_exporterは、Prometheusが正式に提供する輸出業者の1つであり、HTTP、DNS、TCP、およびICMPの監視データ収集を提供できます
関数:
HTTPテスト定義要求ヘッダー情報判断HTTPステータス / HTTP応答ヘッダー / HTTPボディコンテンツTCPテストビジネスコンポーネントポートステータス監視アプリケーションレイヤープロトコル定義と監視ICMPテストホスト検出メカニズム	
テスト後のインターフェイス接続	
SSL証明書の有効期限#ダウンロードと減圧[root@11 prometheus]
[root@11 prometheus]#tar -xvf blackbox_exporter-0.14.0.linux-amd64.tar.gz
[root@11 prometheus]

#インストールが成功しているかどうかを確認します[root@11 prometheus]
Blackbox_exporter、バージョン0.14.0(Branch:Head、Revision:BBA7EF76193948A333A5868A1AB38B864F7D968A)
  ビルドユーザー:root@63d11aa5b6c6
  ビルド日:20190315-13:32:31
  GOバージョン:go1.11.5

#SystemD Management [root@11 Prometheus] #Cat /usr/lib/systemd/system/blackbox_exporter.service
[ユニット]
説明= blackbox_exporter
 
[サービス]
ユーザー=root
タイプ=シンプル
execstart =/usr/local/blackbox_exporter/blackbox_exporter -config.file =/usr/local/blackbox_exporter/blackbox.yml
再起動=失敗時
[root@11 prometheus]# 

#start [root@11 prometheus] #SystemCtl Daemon-Reload
[root@11 prometheus] #SystemCtl enable  -  now blackbox_exporter

11.DockerはNginx-Module-VTSモジュールを展開します

YumにインストールされているNginxには、デフォルトでNginx-Module-VTSモジュールがないため、対応するNginxソースコードをダウンロードして再コンパイルする必要があります。

DockerはConsul Clusterを構築します(完成していません)

1。最初の協議サービスを開始:相談1

Docker run -Name Consul1 -D -P 8500:8500 -P 8300:8300 -P 8301:8301 -P 8302:8302 -P 8600:8600:Always Consul:最新のエージェント-Server -Server -Server -Server -Server -Server -Server -Serte

#consult server1 docker InspectのIPアドレスを取得 -  -format '{{.networksettings.ipaddress}}' Consult1
172.17.0.2

#PS:
    HTTPインターフェイスとWeb UI用の8500 HTTPポート
    8300サーバーRPCポート、同じデータセンターコンサルテーションサーバーがこのポート8301 SERF LANポートを介して通信し、同じデータセンターコンサルテーションクライアントがこのポート8302 SERF WANポートを通じて通信し、このポート8600 DNSポートを介して通信します。
    -UI:Webコンソールを実行します - バインド:ネットワークポートをリッスン、0.0.0.0はすべてのネットワークポートを意味します。

2。2番目の領事サービスを開始:Consul2とConsul1を追加します(Joinコマンドを使用)

docker run -d -name consul2 -d -p 8501:8500 consul agent -server -ui -bind = 0.0.0.0 -client = 0.0.0.0 -Join 172.17.0.2

docker run -d -p 8501:8500  -  Restart = Always -v/xilife/consul/data/server3:/consul/data -v/xilife/consul/confer2:/consul/consul_bind_interface XDP_DC -DATA -DIR /CONSUL /DATA -CONFIG -DIR /CONSUL /CONFIG -JOIN = 172.17.0.2

3。3番目の領事サービスを開始:Consul3とConsul1を追加

docker run -name consul3 -d -p 8502:8500 consul agent -server -ui -bind = 0.0.0.0 -client = 0.0.0.0 -Join 172.17.0.2

4.実行中のコンテナを確認します(Consul Clusterステータス)

[root@k8s -m1 Consult]
ノードアドレスステータスタイプビルドプロトコルDCセグメント
013A4A7E74D2 172.17.0.4:8301 Alive Server 1.10.0 2 DC1 <All>
3C118FA83D47 172.17.0.3:8301 Alive Server 1.10.0 2 DC1 <All>
4B5123C97C2B 172.17.0.5:8301 Alive Server 1.10.0 2 DC1 <All>
A7D272AD157A 172.17.0.2:8301 Alive Server 1.10.0 2 DC1 <All>

5。サービス登録と削除

  • 次に、サービスをConsulに登録します。これは、提供するAPI標準インターフェイスを介して追加できます。
  • 次にnode-exporterテストデータnode-exporter登録します
# 注冊241的node-exporter 服務信息curl -X PUT -d '{"id": "node-exporter","name": "node-exporter-172.23.0.241","address": "172.23.0.241","port": 9100,"tags": ["prometheus"],"checks": [{"http": "http://172.23.0.241:9100/metrics", "interval": "5s"}]}' http://172.23.0.241:8500/v1/agent/service/register

#242のノードエクスポーターサービス情報を登録し、上記のすべてのIPアドレスを242に変更すると、ポートは変更されません。

サービスをログアウトする場合は、上記のnode-exporterサービスのログアウトなど、次のAPIコマンドを使用できます。

curl -xはhttp:///172.23.0.241:8500/v1/agent/service/deregister/node-exporterを入れます

添付ファイル:CentOS6カーネルのアップグレード

RPM -UVH https://hkg.mirror.rackspace.com/elrepo/kernel/el6/x86_64/rpms/elrepo-release-6-12.el6.elrepo.noarch.rpm

YUMソースエラー応答:ミラーソースCD /ETC/YUM.REPOS.Dが見つかりません
MV CENTOS-BASE.REPOCENTOS-BASE.REPO.BACKUP
http://mirrors.163.com/.help/CentOS6-Base-163.repo を取得します。
mv CentOS6-Base-163.repo CentOS-Base.repo
おいしい、すべてきれい
wget -o/etc/yum.repos.d/centos-base.repo http://file.kangle.odata.cc/repo/centos-6.repo http://file.kangle.odata.cc/repo/
wget -o/etc/yum.repos.d/epel.repo http://file.kangle.odata.cc/repo/epel-6.repo http://file.kangle.ordata.cc/repo/epel-6.repo
yum メイクキャッシュ

これは、Prometheusを展開するDockerの展開に関するこの記事の終わりです。

以下もご興味があるかもしれません:
  • docker ベースで Prometheus+Grafana を構築する手順の詳細説明
  • dockerを使用してGrafana+Prometheus構成をデプロイする

<<:  Vue要素ツリーコントロールに点線を追加する詳細な説明

>>:  ウェブページの内部アンカーポイントを実現するための純粋なCSSの上下オフセットコード例

推薦する

複数の Tomcat を展開して起動し、プロジェクトを移行する方法を 1 つの記事で学習します。

目次tomcatをデプロイする1.ダウンロードして解凍する2. 設定ファイルを変更する移植プロジェク...

Linux でファイルを削除するさまざまな方法の効率の比較

Linux で大量のファイルを削除する効率をテストします。まず500,000個のファイルを作成する$...

Dockerコンテナの接続と通信の実装

ポート マッピングは、Docker を別のコンテナーに接続する唯一の方法ではありません。 Docke...

ウェブ クラスターの Docker Stack 展開方法の手順

Docker はますます成熟し、その機能もますます強力になっています。 Docker Stack を...

DockerはRedisをインストールし、操作用のビジュアルクライアントを導入します

1 はじめにRedis 、 ANSI C言語で開発されたKey-Valueベースの高性能NoSQLデ...

HttpとHttpsの両方をサポートするNginxの詳細な設定

最近の Web サイトでは Https をサポートすることがほぼ標準機能となっており、Nginx は...

10秒以内にMySQLデータベースに数百万件のレコードを挿入する実装

まず、次の質問について考えてみましょう。このような膨大な量のデータをデータベースに挿入するには、通常...

MySQL シリーズ II マルチインスタンス構成

チュートリアルシリーズMySQL シリーズ: MySQL リレーショナル データベースの基本概念My...

MySQL ストアドプロシージャとストアドファンクションの詳細な説明

1 ストアドプロシージャ1.1 ストアドプロシージャとは何かストアド プロシージャは、特定の機能を実...

MySQL の挿入およびバッチ ステートメントのいくつかの例の詳細な説明

目次序文1.無視を挿入2. 重複キーの更新時3. を置き換える4.存在しない場合は挿入する5. デー...

MySQL スケジュールバックアップタスクの簡単な分析

導入実稼働環境では、データの損失を回避するために、通常、データベースは定期的にバックアップされます。...

mysql-5.7.21-winx64 無料インストール版のインストール - Windows チュートリアル詳細説明

1 ダウンロードアドレスは https://dev.mysql.com/downloads/mysq...

Vue の基本入門: Vuex のインストールと使用

目次1. vuexとは何か2. インストールと導入3. vuexの使用4. プロセスの紹介5. 突然...

Node.jsとDenoの比較

目次序文Denoとは何ですか? Node.jsとの比較建築ESモジュール依存関係の管理TypeScr...

フォームアクションとonSubmitの例

まず、action はフォームの属性です。HTML5 では必須の属性値として定義されています。onS...