= Talking To {brandname} Memcached Servers From Non-Java Clients

This section shows how to talk to {brandname} Memcached server via a non-Java client, such as a Python script.

== Multi Clustered Server Tutorial

This example showcases the distribution capabilities of {brandname} Memcached severs that are not available in the original Memcached implementation.

.Procedure

. Start two clustered nodes:
This configuration is the same one used for the GUI demo:
+
----
$ ./bin/standalone.sh -c clustered.xml -Djboss.node.name=nodeA
$ ./bin/standalone.sh -c clustered.xml -Djboss.node.name=nodeB -Djboss.socket.binding.port-offset=100
----
+
Alternatively, use:
+
----
$ ./bin/domain.sh
----
+
Which automatically starts two nodes.
+

. Execute the link:https://github.com/infinispan/infinispan/tree/master/server/memcached/src/test/resources/test_memcached_write.py[test_memcached_write.py] script. This basically executes several write operations against the {brandname} Memcached server bound to port `11211`. If the script is executed successfully, you should see an output similar to this:
+
[source,options=nowrap]
----
 Connecting to 127.0.0.1:11211
 Testing set ['Simple_Key': Simple value] ... OK
 Testing set ['Expiring_Key' : 999 : 3] ... OK
 Testing increment 3 times ['Incr_Key' : starting at 1 ]
 Initialise at 1 ... OK
 Increment by one ... OK
 Increment again ... OK
 Increment yet again ... OK
 Testing decrement 1 time ['Decr_Key' : starting at 4 ]
 Initialise at 4 ... OK
 Decrement by one ... OK
 Testing decrement 2 times in one call ['Multi_Decr_Key' : 3 ]
 Initialise at 3 ... OK
 Decrement by 2 ... OK
----
+

. Execute the link:https://github.com/infinispan/infinispan/tree/master/server/memcached/src/test/resources/test_memcached_read.py[test_memcached_read.py] script which connects to server bound to `127.0.0.1:11311` and verifies that it can read the data that was written by the writer script to the first server. If the script is executed successfully, you should see an output similar to this:
+
[source,options=nowrap]
----
 Connecting to 127.0.0.1:11311
 Testing get ['Simple_Key'] should return Simple value ... OK
 Testing get ['Expiring_Key'] should return nothing... OK
 Testing get ['Incr_Key'] should return 4 ... OK
 Testing get ['Decr_Key'] should return 3 ... OK
 Testing get ['Multi_Decr_Key'] should return 1 ... OK
----
