summaryrefslogtreecommitdiff
path: root/docs/examples/timeseries_examples.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'docs/examples/timeseries_examples.ipynb')
-rw-r--r--docs/examples/timeseries_examples.ipynb41
1 files changed, 41 insertions, 0 deletions
diff --git a/docs/examples/timeseries_examples.ipynb b/docs/examples/timeseries_examples.ipynb
index fefc0c8..691e133 100644
--- a/docs/examples/timeseries_examples.ipynb
+++ b/docs/examples/timeseries_examples.ipynb
@@ -599,6 +599,47 @@
"source": [
"ts.range(\"ts_key_incr\", \"-\", \"+\")"
]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## How to execute multi-key commands on Open Source Redis Cluster"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "outputs": [
+ {
+ "data": {
+ "text/plain": "[{'ts_key1': [{}, 1670927124746, 2.0]}, {'ts_key2': [{}, 1670927124748, 10.0]}]"
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import redis\n",
+ "\n",
+ "r = redis.RedisCluster(host=\"localhost\", port=46379)\n",
+ "\n",
+ "# This command should be executed on all cluster nodes after creation and any re-sharding\n",
+ "# Please note that this command is internal and will be deprecated in the future\n",
+ "r.execute_command(\"timeseries.REFRESHCLUSTER\", target_nodes=\"primaries\")\n",
+ "\n",
+ "# Now multi-key commands can be executed\n",
+ "ts = r.ts()\n",
+ "ts.add(\"ts_key1\", \"*\", 2, labels={\"label1\": 1, \"label2\": 2})\n",
+ "ts.add(\"ts_key2\", \"*\", 10, labels={\"label1\": 1, \"label2\": 2})\n",
+ "ts.mget([\"label1=1\"])"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
}
],
"metadata": {