Apache Ignite基本概念及最佳实践(三)——监测篇

1,318 阅读2分钟

一、前言

Apache Ignite系列

二、REST API

1.简介

Ignite提供了REST客户端,通过HTTP和HTTPS进行通信,可以读写缓存,执行任务,获取指标

2.准备

想要使用这个功能,首先要把ignite-rest-http模块从IGNITE_HOME/libs/optional/文件夹中移动到IGNITE_HOME/libs文件夹下,默认端口号是8080

3.使用

  • 查看版本curl 'http://localhost:8080/ignite?cmd=version'
  • 插入数据curl 'http://localhost:8080/ignite?cmd=put&cacheName=myCache' -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d 'key=testKey&val=testValue'
  • 查询数据http://[host]:[port]/ignite?cmd=get&key=testKey&cacheName=myCache&keyType=int&valueType=date
  • 查看缓存中数据量http://host:port/ignite?cmd=size&cacheName=myCache
  • 更多API请参考官方文档:ignite.apache.org/docs/latest…

三、control.sh

1.简介

用于监视集群状态和控制集群

2.使用

  • 获取集群状态./control.sh --state
  • 查看集群拓扑状态./control.sh --baseline
  • 设置集群状态control.sh --set-state ACTIVE
  • 更多API请参考官方文档:ignite.apache.org/docs/latest…

四、dbeaver连接ignite

1.下载dbeaver

dbeaver.io/download/

2.配置driver manager

  • 首先选择Database->Driver Manager
    image.png
  • 选择Apache Ignite -> Edit,之后通过Add Folder或Add Artifact来添加ignite-core依赖
    image.png

3.配置连接

左上角新建连接,配置端口号即可,连接server节点默认是10800,连接client节点默认是47500
image.png

4.注意事项

只有通过setIndexedTypes建立索引后的数据,才可以通过dbeaver查到,如果只是key-value存储,应使用REST API来查询

五、总结

监测篇内容就是这些,后续会继续更新在实际应用中的一些补充知识点