BTW: 

this is the result of netstat on the zk server: 


tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1838/ java 

tcp 0 0 ***.***.***.***:3888 0.0.0.0:* LISTEN 1214/ java 

tcp 0 0 0.0.0.0:40864 0.0.0.0:* LISTEN 1214/ java 

tcp 0 0 0.0.0.0:2181 0.0.0.0:* LISTEN 1214/ java 

as you can see, the zk server is listening on port 3888 as specified in the zk 
config file and on 2181 as specified in the RSA discovery settings in karaf 

while this is the result of netstat on the karaf server that is using zk to 
communicate with remote services. 


tcp 0 0 127.0.0.1:1099 0.0.0.0:* LISTEN 15258/ java 

tcp 0 0 0.0.0.0:46445 0.0.0.0:* LISTEN 15258/ java 

tcp 0 0 127.0.0.1:38707 0.0.0.0:* LISTEN 15258/ java 

tcp 0 0 0.0.0.0:8181 0.0.0.0:* LISTEN 15258/ java 

tcp 0 0 0.0.0.0:2550 0.0.0.0:* LISTEN 15258/ java 

tcp 0 0 127.0.0.1:44444 0.0.0.0:* LISTEN 15258/ java 

tcp 0 0 127.0.0.1:32000 0.0.0.0:* LISTEN 15258/ java 

tcp 0 0 0.0.0.0:8101 0.0.0.0:* LISTEN 15258/ java 





--- 

Schéin Gréiss, 
Mit freundlichen Grüßen, 
Meilleures salutations, 
Kind regards, 
Alex Weirig 
Responsable Technique 

Ville de Luxembourg - Centre Technolink 
2, rue Charles de Tornaco 
L - 2623 LUXEMBOURG 
[ mailto:alex.wei...@technolink.lu | alex.wei...@technolink.lu ] 


Tel: +352 4796 - 6127 
Fax: +352 42 88 81 
[ http://www.technolink.lu/ | www.technolink.lu ] 


From: "Alex Weirig" <alex.wei...@technolink.lu> 
To: "user" <user@aries.apache.org> 
Sent: Friday, September 15, 2017 11:55:23 PM 
Subject: Re: Echo TCP example not working on computer with multiple NICs 

Jonathan, 

good to hear that it is somewhat working although not the way you expected ... 

Are you sure you want to run zk on the same servers as your servicemix? If you 
get other services relying on zk you might want to run zk on dedicated 
"servers" (that can be VMs or nowadays containers). Since zk doesn't require a 
lot of resources it's not that bad to have multiple isolated copies of zk 
running. As I said we went with 3 instances (one of them always being elected 
to be the master). The zk configuration file is residing on a shared drive 
mounted into each of the zk instances, so they all share the same 
configuration. We monitor the zk with exhibitor. 

I wonder if you didn't see the server on the consumer computer because that zk 
doesn't have anything to publish while the service computer is actually 
publishing a service. 

I can try and check what the netstat looks like on our servers. 

I remember my early zk days when I ran zk on the same server as karaf and also 
had the bundle stop and start the zk service, so I think that's expected. 

At the end of the day, you only need to run zk on one single server. Your 
"Service" computer needs to know where zk is running to publish it's services 
to zk, your client computer needs to know where zk is running to create a 
"local" proxy for the remote service when it is used locally on the client 
computer. 

Basically these are the bundles I'm running in Karaf to use zk with fastbin 
transport. 



106 │ Active │ 80 │ 1.10.0 │ Aries Remote Service Admin Core 

107 │ Active │ 80 │ 1.10.0 │ Aries Remote Service Admin Discovery Gogo Commands 

108 │ Active │ 80 │ 1.10.0 │ Aries Remote Service Admin Discovery Local 

109 │ Active │ 80 │ 1.10.0 │ Aries Remote Service Admin Discovery Zookeeper 

110 │ Active │ 80 │ 1.10.0 │ Aries Remote Service Admin Event Publisher 

111 │ Active │ 80 │ 1.10.0 │ Aries Remote Service Admin provider FastBin 

112 │ Active │ 80 │ 1.10.0 │ Aries Remote Service Admin SPI 

113 │ Active │ 80 │ 1.10.0 │ Aries Remote Service Admin Topology Manager 

127 │ Active │ 80 │ 3.4.7 │ ZooKeeper Bundle 

Gogo commands are not mandatory I think but can be useful. You can also deploy 
a different provider other than fastbin. 


--- 

Schéin Gréiss, 
Mit freundlichen Grüßen, 
Meilleures salutations, 
Kind regards, 
Alex Weirig 
Responsable Technique 

Ville de Luxembourg - Centre Technolink 
2, rue Charles de Tornaco 
L - 2623 LUXEMBOURG 
[ mailto:alex.wei...@technolink.lu | alex.wei...@technolink.lu ] 


Tel: +352 4796 - 6127 
Fax: +352 42 88 81 
[ http://www.technolink.lu/ | www.technolink.lu ] 


From: "Jonathan knez" <jonathank...@hotmail.com> 
To: "Alex Weirig" <alex.wei...@technolink.lu>, user@aries.apache.org 
Sent: Friday, September 15, 2017 10:56:55 PM 
Subject: Re: Echo TCP example not working on computer with multiple NICs 

Alex, 

Thank you for the help. This got me pointed in the right direction. Although 
there are still some things I don't understand, it is working now. 

I downloaded the zookeeper release archive from their website. I then ran the 
zkCli script on each of my servers and attempted to connect on the default port 
of 2181. This was successful on the "Service" computer. It failed on the 
"Consumer" computer. I then ran "sudo netstat -anp | grep LISTEN | grep java" 
to see what ports java was even listing on. Port 2181 is not one of them. So I 
can say with confidence that the zookeeper server is not running on the 
"Consumer" computer. 

I ran the netstat on the "Service" computer and I see 2181 in the list. When I 
stop the "Aries Remote Service Admin Discovery Zookeeper" bundle in servicemix, 
the zookeeper server stops. When I start that bundle, the zookeeper server 
starts. So it looks like that bundle is actually launching the zookeeper 
server. 

I verified that bundle is started on the "Consumer" computer and it is. I can 
start and stop that bundle all I want but zookeeper never successfully starts. 
This is the part I don't understand. Regardless, I did what you said and filled 
out <service_mix_dir>/etc/org.apache.aries.rsa.discovery.zookeeper.cfg with the 
host and port for my "Service" computer. So both computers are sharing the same 
one zookeeper instance. With that change, the echo example works correctly. 

So the problem was down to the fact that zookeeper was not running on one 
computer. I still don't know why it was not running, but I was able to work 
around it. 

I suppose in the long run I will want to run one instance of zookeeper per 
computer, regardless of how many servicemix instances I am running on that 
computer. With that in mind, I probably wont' ever take the time to figure out 
why zookeeper was not running in servicemix on that computer. 

Jonathan 

From: Alex Weirig <alex.wei...@technolink.lu> 
Sent: Friday, September 15, 2017 3:44 AM 
To: user@aries.apache.org; Jonathan knez 
Subject: Re: Echo TCP example not working on computer with multiple NICs 


Hi Jonathan, 




I'm not sure if this can help you but this is how I use karaf and zookeeper: 




1) tell RSA where to find zookeeper: 

Place a file named "org.apache.aries.rsa.discovery.zookeeper.cfg" with the 
following content into karaf's "etc" folder: 




zookeeper.host = dns name of your zookeeer server 
zookeeper.port = 2181 
zookeeper.timeout = 3000 








2) when using fastbin as transport I have to create a file named 
"org.apache.aries.rsa.provider.fastbin.cfg" in the "etc" folder containing: 




uri = tcp://0.0.0.0:2550 




otherwise I get a port collision 







3) configure zookeeper, e.g. 




# The number of milliseconds of each tick 
tickTime=2000 

# The number of ticks that the initial 
# synchronization phase can take 
initLimit=10 

# The number of ticks that can pass between 
# sending a request and getting an acknowledgement 
syncLimit=5 

# the directory where the snapshot is stored. 
# do not use /tmp for storage, /tmp here is just 
# example sakes. 
dataDir=/opt/zookeeper-data 

# Transaction log 
#dataLogDir=/opt/zookeeper-data-log 

# the port at which the clients will connect 
clientPort=2181 

# the maximum number of client connections. 
# increase this if you need to handle more clients 
maxClientCnxns=60 

# 
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge. 
# 
# [ http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance 
| 
http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance ] 
# 
# The number of snapshots to retain in dataDir 
#autopurge.snapRetainCount=3 

# Purge task interval in hours 
# Set to "0" to disable auto purge feature 
#autopurge.purgeInterval=1 

# Cluster servers 
server.1=zk1:2888:3888 
server.2=zk2:2888:3888 
server.3=zk3:2888:3888 















Schéin Gréiss,
Mit freundlichen Grüßen,
Meilleures salutations,
Kind regards, 
Alex Weirig Responsable Technique 
Ville de Luxembourg - Centre Technolink
2, rue Charles de Tornaco
L - 2623 LUXEMBOURG [ mailto:alex.wei...@technolink.lu | 
alex.wei...@technolink.lu ] Tel: +352 4796 - 6127
Fax: +352 42 88 81 [ http://www.technolink.lu/ | www.technolink.lu ] 
On 15/09/2017 00:49, Jonathan knez wrote: 



I am just getting started with remote services in OSGi. To that end, I have 
downloaded Apache Karaf 4.1.2 and run through the Echo TCP example from the 
Aries-RSA github page. Here is a link. 
[ https://github.com/apache/aries-rsa/tree/master/examples/echotcp | 
https://github.com/apache/aries-rsa/tree/master/examples/echotcp ] 


The example ran successfully when running two karaf instances on my single 
computer. I then ran one karaf instance on another networked computer. The two 
computers are connected via a LAN that allows all manner of network 
communication including multicast. When running the "Service" on one computer 
and the "Consumer" on the other computer, the example does not work. The 
Consumer bundle stays in a Waiting state. 

When I run rsa:endpoints on the "Service" computer, I see that the EchoService 
is correctly bound to a local IP address. When I run rsa:endpoints on the 
"Consumer" computer, it shows no services. 

The issue appears to be that the karaf instance on the "Consumer" computer has 
not found the "Service" endpoint on the other computer. Both computers have 
multiple NICs and multiple active network connections. Only one connection 
allows them to talk to each other. It just so happens that the "Service" 
endpoint is using the right address. I suspect that the "Consumer" karaf 
instance is not so lucky and is using the wrong NIC. 

So my question is how can I configure this? I believe this might be a Zookeeper 
question but I am not clear on how to configure the zookeeper instance that 
Aries-RSA launches. 

I appreciate the help. 

Jonathan 
-- 
This email was Anti Virus checked by SOPHOS UTM 




Reply via email to