使用docker 运行,文档参考的官方的5 分钟学习文档

拉取镜像

docker pull apachegeode/geode

启动

docker run -it -p 10334:10334 -p 7575:7575 -p 1099:1099 -p 40404:40404  apachegeode/geode

初始化数据

容器内

start locator
start server
create region --name=hello --type=REPLICATE 

提示信息

create region --name=hello --type=REPLICATE 
     Member | Status
---------------- | ---------------------------------------------
fix-powerful-cup | Region "/hello" created on "fix-powerful-cup"
 
 

简单运行

因为使用了容器,同时我们需要配置一个简单hosts 别名

/etc/hosts
127.0.0.1 55bbae309e69
 

使用maven 管理

  • 项目结构
├── pom.xml
└── src
    ├── main
    │ ├── java
    │ │ └── com
    │ │ └── dalong
    │ │ └── Application.java
    │ └── resources
    └── test
        ├── java
        └── resources
 
 
  • 代码说明
    pom.xml
 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.dalong.app</groupId>
  <artifactId>dw-jdbc-app</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <dependencies>
   <dependency>
        <groupId>org.apache.geode</groupId>
        <artifactId>geode-core</artifactId>
        <version>1.8.0</version>
    </dependency>
  </dependencies>
</project>
 
 

application.java

package com.dalong;
import java.util.Map;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.*;
public class Application {
  public static void main(String[] args) {
    ClientCache cache = new ClientCacheFactory()
        .addPoolLocator("localhost", 10334)
         .create();
          Region<String, String> region = cache
            .<String, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
            .create("hello");
          region.put("1", "Hello");
          region.put("2", "World");
          for (Map.Entry<String, String> entry : region.entrySet()) {
            System.out.format("key = %s, value = %s\n", entry.getKey(), entry.getValue());
          }
          cache.close();
  }
}
 
 
  • 运行效果
[info 2019/01/10 16:02:11.749 CST <main> tid=0x1] initializing InternalDataSerializer with 0 services
[info 2019/01/10 16:02:11.784 CST <main> tid=0x1] [ThreadsMonitor] New Monitor object and process were created.
[info 2019/01/10 16:02:11.812 CST <StatSampler> tid=0x11] Disabling statistic archival.
[info 2019/01/10 16:02:11.839 CST <main> tid=0x1] Running in client mode
[info 2019/01/10 16:02:11.955 CST <main> tid=0x1] AutoConnectionSource UpdateLocatorListTask started with interval=10000 ms.
[info 2019/01/10 16:02:11.957 CST <main> tid=0x1] Pool DEFAULT started with multiuser-authentication=false
[info 2019/01/10 16:02:12.004 CST <poolTimer-DEFAULT-3> tid=0x1a] Updating membership port. Port changed from 0 to 52778. ID is now bogon(71460:loner):0:b16ec836
key = 1, value = Hello
key = 2, value = World
[info 2019/01/10 16:02:12.084 CST <main> tid=0x1] GemFireCache[id = 1097897234; isClosing = true; isShutDownAll = false; created = Thu Jan 10 16:02:11 CST 2019; server = false; copyOnRead = false; lockLease = 120; lockTimeout = 60]: Now closing.
[info 2019/01/10 16:02:12.132 CST <main> tid=0x1] Destroying connection pool DEFAULT
 

说明

apache geode 功能还是很强大的,同时也很灵活

参考资料

https://cwiki.apache.org/confluence/display/GEODE/Index#Index-Geodein5minutesGeodein5minutes
https://hub.docker.com/r/apachegeode/geode
https://github.com/rongfengliang/geode-java-demo

最新文章

  1. JavaWeb_day04搜索_乱码_路径_转发重定向_cookie
  2. 【Windows编程】系列第四篇:使用Unicode编程
  3. string、Empty和null三者的区别
  4. java中string内存的相关知识点
  5. ios8版本地图定位注意点
  6. Xcode 缓存 帮助文档 隐藏文件夹显示方法
  7. DWZ框架一些技巧
  8. 2014 多校联合训练赛6 Fighting the Landlords
  9. hdu 4741 Save Labman No.004(2013杭州网络赛)
  10. 【转】 bio 与块设备驱动
  11. 痞子衡嵌入式:飞思卡尔Kinetis系列MCU开发那些事 - 索引
  12. Linux 内存释放命令非常不错具有参考借鉴价值
  13. IObservable 接口
  14. html image 圖像路徑
  15. ES系列十七、logback+ELK日志搭建
  16. UX设计秘诀之注册表单设计,细节决定成败
  17. 服务器返回的http状态码
  18. bzoj 1178 [Apio2009]CONVENTION会议中心
  19. 成为linux的合格公民
  20. Redis学习(8)-redis其他特性

热门文章

  1. 【JAVA多线程】interrupted() 和 isInterrupted() 的区别
  2. Linux系统下yum源配置(Centos 6)
  3. CKEditor编辑器的使用
  4. ssh免密登陆
  5. 装饰器-wrapper
  6. POJ - 2635 E - The Embarrassed Cryptographer
  7. Codeforces Round #495 (Div. 2) B
  8. 如何实时查看Linux下日志
  9. TkbmMWFileClient产生的Timeout/error waiting for connection.
  10. kali linux 入侵window实例