Install and use apache geode
Recently, I was studying the open source in-memory database, and apache ignite used it for some time to feel that it was okay because there was too little data, so I just used its rpc function to build a distributed framework.
The apache geode framework was discovered the day before yesterday, which is said to be the open source version of Gemfire 12306.
Official website address: http://geode.apache.org/
I. installation
Before installation, jdk (preferably jdk1.8) must be installed on the server and JAVA_HOME must be configured.
download
Wget http://mirrors.tuna.tsinghua.edu.cn/apache/geode/1.2.1/apache-geode-1.2.1.tar.gztar-zxvf apache-geode-1.2.1.tar.gz-C / opt/cd / opt/apache-geode-1.2.1/
Add bin to PATH
Vi / etc/profile
Add on the last line
Export PATH=$PATH:/opt/apache-geode-1.2.1/bin
Make the environment variable effective
Source / etc/profile
Test whether the installation is successful
Gfsh version-- full [root@master ~] # gfsh version-- fullBuild-Date: 2017-09-16 07:20:46-0700Build-Id: abaker 0Build-Java-Version: 1.8.0_121Build-Platform: Mac OS X 10.12.3 x86_64Product-Name: Apache GeodeProduct-Version: 1.2.1Source-Date: 2017-09-08 11:57:38-0700Source-Repository: release/1.2.1Source-Revision: 0b881b515eb1dcea974f0f5c1b40da03d42af9cfNative version: native code unavailableRunning on: / 192.168.60.50, 4 cpu (s) Amd64 Linux 3.10.0-327.el7.x86_64
2. Start
Starting locator,locator I understand that similar to a request forwarder is responsible for forwarding various queries to each server. The default port is: 10334
[root@master] # gfsh _ / _ _ / / _ / _ / / / 1.2.1Monitor and Manage Apache Geodegfsh > gfsh > start locator-- name=locator50
Start server
Gfsh > start server--name=server50-- server-port=40411
Check the cluster. There is only one.
Gfsh > list members Name | Id- |-locator50 | 192.168.60.50 (locator50:32148:locator): 1024server50 | 192.168.60.50 (server50:32411): 1025
Third, try the command line
Please refer to the document: http://geode.apache.org/docs/guide/12/getting_started/15_minute_quickstart_gfsh.html
3.1 connecting to locator as a client
If the connect command does not take any parameters, it means to connect to the local machine
Gfsh > connect-- locator=192.168.60.50 [10334] Connecting to Locator at [host=192.168.60.50, port=10334].. Connecting to Manager at [host=master, port=1099].. Successfully connected to: [host=master, port=1099]
3.2Create region
Region can think of tables in the database
Create region-name=regionA-type=REPLICATE_PERSISTENT
3.2 View region list
Gfsh > list regionsList of regions-regionA
Insert two pieces of kv data
Gfsh > put-region=regionA-key= "1"-value= "one" Result: trueKey Class: java.lang.StringKey: 1Value Class: java.lang.StringOld Value: gfsh > put-region=regionA-key= "2"-value= "two" Result: trueKey Class: java.lang.StringKey: 2Value Class: java.lang.StringOld Value:
3.4 query data
Gfsh > query-- query= "select * from / regionA" Result: trueLimit: 100Rows: 2Result-twoone