curl是一个非常实用的、用来与服务器之间传输数据的工具;支持的协议包括 (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP),curl设计为无用户交互下完成工作,linux curl功能十分强大,命令参数十分多, 可运行“man curl”命令查看

目录:

  • 访问ES:_cat系列
  • 访问ES:_cluster系列
  • 访问ES:_nodes系列
  • 访问ES:{index}系列

访问ES:_cat系列


  • /_cat/allocation
  • /_cat/shards
  • /_cat/master
  • /_cat/nodes
  • /_cat/indices
  • /_cat/segments
  • /_cat/count
  • /_cat/recovery
  • /_cat/health
  • /_cat/pending_tasks
  • /_cat/aliases
  • /_cat/thread_pool
  • /_cat/plugins
  • /_cat/fielddata
  • /_cat/XXXX/{index}
  • 示例如下图:
  • ES(6): access elasticsearch via curl

访问ES:_cluster系列


  • /_cluster/health?pretty             (查询设置集群状态, pretty=true表示格式化输出)
  • /_cluster/stats?pretty                (显示集群系统信息,包括CPU JVM等等)
  • /_cluster/state?pretty                (集群的详细信息。包括节点、分片等)
  • /_cluster/pending_tasks?pretty   (获取集群堆积的任务)
  • /_cluster/nodes/192.168.1.1/_shutdown   (关闭指定节点)
  • /_cluster/nodes/_master/_shutdown         (关闭主节点)
  • /_shutdown?delay=10s                            (delay=10s表示延迟10秒关闭所有节点)
  • /_cluster/nodes/_shutdown 或 /_cluster/nodes/_all/_shutdown    (关闭所有节点)
  • 修改集群配置, transient 表示临时的,persistent表示永久的, 如下代码
    /_cluster/settings -d '{
        "persistent" : {
            "discovery.zen.minimum_master_nodes" : 2
        }
    }'
  • ES(6): access elasticsearch via curl

访问ES:_nodes系列


  • /_nodes/stats?pretty=true
  • /_nodes/192.168.1.2/stats?pretty=true
  • /_nodes/process
  • /_nodes/_all/process
  • /_nodes/192.168.1.2,192.168.1.3/jvm,process
  • /_nodes/192.168.1.2,192.168.1.3/info/jvm,process
  • /_nodes/192.168.1.2,192.168.1.3/_all
  • /_nodes/hot_threads
  • ES(6): access elasticsearch via curl

访问ES:{index}系列


  • 简单创建索引: curl -XPUT 'http://10.0.0.5:12000/test/'
  • 删除索引:      curl -XDELETE 'http://10.0.0.5:12000/test/'
  • 设置mapping,如下示例
    curl -XPUT 'http://10.0.0.5:12000/etlstasday' -d '
    {    
      "settings": {
        "number_of_shards": 5,
        "number_of_replicas": 1
      },
      "mappings": {
        "etlstasday": {
          "properties": {
            "电站名称": {
              "type": "text",
              "fields": {
                "keyword": {
                  "ignore_above": 256,
                  "type": "keyword"
                }
              }
            },
            "业务日期": {
              "format": "yyyyMMddZ",
              "type": "date"
            },
            "总电量": {
              "type": "double"
            },
            "总收入(元)": {
              "type": "double"
            }
          }
        }
      }
    }'
    View Code

相关文章:

  • 2021-09-09
  • 2021-12-22
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2021-10-24
  • 2021-05-23
猜你喜欢
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案