You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jc...@apache.org on 2018/06/22 00:30:18 UTC

[geode-examples] 01/01: Added example of overflow

This is an automated email from the ASF dual-hosted git repository.

jchen21 pushed a commit to branch feature/overflow-example
in repository https://gitbox.apache.org/repos/asf/geode-examples.git

commit 53eec9b6a215a68b35a066b28d521aa9d48a2cfa
Author: Patrick Johnson <kc...@gmail.com>
AuthorDate: Thu Jun 21 17:28:59 2018 -0700

    Added example of overflow
    
    Signed-off-by: Jianxia Chen <jc...@apache.org>
---
 overflow/README.md          | 48 +++++++++++++++++++++++++++++++++++++++++++++
 overflow/scripts/start.gfsh | 33 +++++++++++++++++++++++++++++++
 overflow/scripts/stop.gfsh  | 22 +++++++++++++++++++++
 3 files changed, 103 insertions(+)

diff --git a/overflow/README.md b/overflow/README.md
new file mode 100644
index 0000000..99ed0a0
--- /dev/null
+++ b/overflow/README.md
@@ -0,0 +1,48 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+# Geode Overflow Example
+
+This examples demonstrates how to use Geode's Overflow to disk.
+
+In this example a server hosts a partitioned region that stores strings. 
+The example shows data being overflowed to disk and removed from memory.
+
+This example assumes that Geode is installed.
+
+## Set up the region
+1. Set directory ```geode-examples/overflow``` to be the
+current working directory.
+Each step in this example specifies paths relative to that directory.
+
+2. Run a script that starts a locator and two servers. The script
+then creates the ```example-region``` region and puts 4 values.
+
+        $ gfsh run --file=scripts/start.gfsh
+
+3. Shut down the cluster
+
+        $ gfsh run --file=scripts/stop.gfsh
+        
+4. Notice the line 
+`diskstore | totalEntriesOnlyOnDisk       | 2` from `show metrics --region=example-region`.
+This shows that 2 values have been overflowed to disk and are no longer in memory.
+Notice that the size from `describe region --name=example-region` 
+is still 4 `Region   | size                   | 2`. 
+The entries are still accessible.
+
+
diff --git a/overflow/scripts/start.gfsh b/overflow/scripts/start.gfsh
new file mode 100644
index 0000000..caf8911
--- /dev/null
+++ b/overflow/scripts/start.gfsh
@@ -0,0 +1,33 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+start locator --name=locator --bind-address=127.0.0.1
+
+start server --name=server1 --locators=127.0.0.1[10334] --server-port=0
+
+create region --name=example-region --type=PARTITION_OVERFLOW --eviction-entry-count=2 --eviction-action=overflow-to-disk
+
+list members
+describe region --name=example-region
+show metrics --region=example-region
+
+put --key=1 --value=one --region=example-region
+put --key=2 --value=two --region=example-region
+put --key=3 --value=three --region=example-region
+put --key=4 --value=four --region=example-region
+
+
+
diff --git a/overflow/scripts/stop.gfsh b/overflow/scripts/stop.gfsh
new file mode 100644
index 0000000..2e937bf
--- /dev/null
+++ b/overflow/scripts/stop.gfsh
@@ -0,0 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+connect --locator=127.0.0.1[10334]
+
+describe region --name=example-region
+show metrics --region=example-region
+
+shutdown --include-locators=true
\ No newline at end of file