apache geode 试用
使用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
apache geode 试用的更多相关文章
- Apache Geode with Spark
在一些特定场景,例如streamingRDD需要和历史数据进行join从而获得一些profile信息,此时形成较小的新数据RDD和很大的历史RDD的join. Spark中直接join实际上效率不高: ...
- 一文读懂Apache Geode缓存中间件
目录 一.对缓存中间件的诉求 1.1 我们为什么需要缓存中间件 1.2 缓存的分类 1.1.1 弱势缓存 1.1.2 强势缓存 二.什么是Apache Geode 2.1 Apache Geode的架 ...
- apache phoenix 安装试用
备注: 本次安装是在hbase docker 镜像的基础上配置的,主要是为了方便学习,而hbase搭建有觉得 有点费事,用镜像简单. 1. hbase 镜像 docker pull har ...
- Geode集群搭建
Geode集群搭建 1.下载安装包 http://mirror.bit.edu.cn/apache/geode/1.2.0/ 2.安装解压后即可直接使用 apache-geode-1.2.0 3.进入 ...
- 盘点Apache毕业的11个顶级项目
自1999年成立至今,Apache 软件基金会已成功建立起自己强大的生态圈.其社区涌现了非常多优秀的开源项目,同时有越来越多国内外项目走向这个国际开源社区进行孵化.据悉,目前所有的 Apache 项目 ...
- Geode member发现机制
Geode member发现机制 Apache Geode 为集群和客户端服务器间提供了多种member 发现机制,具体如下: Peer Member Discovery Standalone Mem ...
- Java实现FTP上传下载功能
Java FTP客户端工具包很多,在此我选用的Apache的FTPClient.这个包的获取可以通过http://commons.apache.org/net/来获取,我使用的是最新的commons- ...
- Flink - Juggling with Bits and Bytes
http://www.36dsj.com/archives/33650 http://flink.apache.org/news/2015/05/11/Juggling-with-Bits-and-B ...
- PHP 安装与配置(WIN10)
需要在本地搭个PHP的测试环境,顺手将过程写了下来. 由于不是生产环境,我这里直接选择了最新的PHP版本用来测试. 本地坏境为:windows 10 Pro 1709 PHP版本:php-7.2.3- ...
随机推荐
- GFS中文翻译
Google文件系统 GFS是一个可扩展的分布式文件系统,用于大型的.分布式的.对大量数据进行访问的应用.它运行于廉价的普通硬件上,但可以提供容错功能.它可以给大量的用户提供总体性能较高的服务. 1. ...
- TypeError: write() argument must be str, not bytes报错原因及Python3写入二进制文件方法
Python2随机写入二进制文件: with open('/python2/random.bin','w') as f: f.write(os.urandom(10)) 但使用Python3会报错: ...
- Traumland--梦乡--IPA--德语
德国电影<<英俊少年>>的插曲.
- House Robber III
The thief has found himself a new place for his thievery again. There is only one entrance to this a ...
- Linux输入子系统 : 按键驱动
一.Linux input system框架: 1.由输入子系统核心层(input.c),驱动层(gpio_keys.c)和事件处理层(Event Handler)三部份组: 2.主要的三个结构体:i ...
- AssetBundle打包详解
Unity5.x AssetBundle打包详解 在网上查看了很多资料,想详细搞清楚AssetBundle的原理.以实现符合项目需求的打包工具和加载逻辑 1. AssetBundle是什么? Asse ...
- WebClient和WebRequest获取html代码
HTML: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.as ...
- SQL拼接大法
SQL拼接大法: Step1:括号先写上() Step2:在括号内写上(, , , , , ,) Step3:再写上单引号(,' ' ...
- ob 函数的使用
ob 函数的使用1. 页面静态化 $id = isset($_GET['id'])?$_GET['id']-0:0; $filename = "html/".date(" ...
- BF字符串匹配算法
Brute Force算法是普通的模式匹配算法,BF算法的思想就是将目标串S的第一个字符与模式串T的第一个字符进行匹配,若相等,则继续比较S的第二个字符和 T的第二个字符: 若不相等,则比较S的第二个 ...