简体   繁体   English

Apache Ignite-简单的Python示例

[英]Apache Ignite - simple Python example

I started Apache Ignite node on my local Mac and tried to run Python script to see if it can connect: 我在本地Mac上启动了Apache Ignite节点,并尝试运行Python脚本以查看它是否可以连接:

import pylibmc
client = pylibmc.Client (["127.0.0.1:11211"], binary=True)
client.set("key", "val")

Got error: 得到错误:

Traceback (most recent call last):
  File "test.py", line 14, in <module>
    client.set("key", "val")
pylibmc.UnknownReadFailure: error 7 from memcached_set: (0x7fd26cc3d8d0) UNKNOWN READ FAILURE,  host: 127.0.0.1:11211 -> libmemcached/response.cc:828

Does anyone know what could be the problem? 有谁知道可能是什么问题? Or if you have simpler example with step by step to run Apache Ignite with Python, please let me know. 或者,如果您有更简单的示例(逐步介绍如何使用Python运行Apache Ignite),请告诉我。 (I tried few examples on line and none so far worked).. (我尝试了一些示例,但到目前为止都没有奏效)。

To connect to Ignite using a Python client for Memcached, you need to download Ignite and - 要使用用于Memcached的Python客户端连接到Ignite,您需要下载Ignite,然后-

  1. Start Ignite cluster with cache configured. 使用已配置的缓存启动Ignite群集。 For example: 例如:

Shell bin/ignite.sh examples/config/example-cache.xml 2. Connect to Ignite using Memcached client, via binary protocol. Shell bin / ignite.sh examples / config / example-cache.xml 2.使用Memcached客户端通过二进制协议连接到Ignite。

Python import pylibmc Python导入pylibmc

client = pylibmc.Client (["127.0.0.1:11211"], binary=True) 客户端= pylibmc.Client([“ 127.0.0.1:11211”],二进制= True)

client.set("key", "val") client.set(“ key”,“ val”)

print "Value for 'key': %s"%client.get("key") 打印“键的值:%s”%client.get(“键”)

from: https://apacheignite.readme.io/docs/memcached-support#python 来自: https : //apacheignite.readme.io/docs/memcached-support#python

Looks like you didn't pass proper config to ignite: 看来您没有通过适当的配置来点燃:

bin/ignite.sh examples/config/example-cache.xml bin / ignite.sh示例/config/example-cache.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM