OpenShift Origink8s-openshift-okd

OpenShift 命令行大全

2019-08-09  本文已影响0人  王彦锋BlackStone
np="openshift-logging"; \
oc get pods -l component=es -o name  -n $np |cut -d -f2

进入ES POD后,在容器elasticsearch中执行curl命令

np="openshift-logging"; \
oc exec `oc get pods -l component=es -o name  -n $np |cut -d/ -f2` \
  -c elasticsearch   \
  -n $np     \
  -- curl -v \
     --head  \
     --cacert etc/elasticsearch/secret/admin-ca \
     --cert   etc/elasticsearch/secret/admin-cert \
     --key    etc/elasticsearch/secret/admin-key  \
     https//:localhost:9200/

进入kibana POD,在容器kibana中执行curl命令

np="openshift-logging"; \
oc exec `oc get pods -l component=kibana-ops -o name  -n $np |cut -d/ -f2` \
  -c kibana   \
  -n $np     \
  -- curl -s \
     --cacert /etc/kibana/keys/ca \
     --cert /etc/kibana/keys/cert \
     --key /etc/kibana/keys/key \
     https://logging-es:9200/

查看集群状态

np="openshift-logging"; \
oc exec `oc get pods -l component=es -o name  -n $np |cut -d/ -f2` \
  -c elasticsearch   \
  -n $np     \
  -- curl  -s \
       --cacert /etc/elasticsearch/secret/admin-ca   \
       --cert /etc/elasticsearch/secret/admin-cert   \
       --key  /etc/elasticsearch/secret/admin-key    \
       https://localhost:9200/_cluster/health?pretty=true

查看索引状态

np="openshift-logging"; \
oc exec `oc get pods -l component=es -o name  -n $np |cut -d/ -f2` \
  -c elasticsearch   \
  -n $np      \
  -- curl -s  \
        --cacert /etc/elasticsearch/secret/admin-ca  \
        --cert /etc/elasticsearch/secret/admin-cert  \
        --key  /etc/elasticsearch/secret/admin-key   \
        https://localhost:9200/_cat/indices?v

设置集群索引为无副本,防止单节点集群出现“unassigned_shards>0”的情况发生

np="openshift-logging"; \
oc exec `oc get pods -l component=es -o name  -n $np |cut -d/ -f2` \
  -c elasticsearch   \
  -n $np      \
  -- curl -s  \
        --cacert /etc/elasticsearch/secret/admin-ca    \
        --cert   /etc/elasticsearch/secret/admin-cert  \
        --key    /etc/elasticsearch/secret/admin-key   \
        -H "Content-Type: application/json"            \
        -XPUT 'https://localhost:9200/_settings'       \
        -d '{
            "index" : {
                "number_of_replicas" : 0
            }
        }'
上一篇 下一篇

猜你喜欢

热点阅读