-
Notifications
You must be signed in to change notification settings - Fork 430
OBP API Setup for Fault Tolerance
Mulugeta Ayalew edited this page Jun 20, 2017
·
3 revisions
- NGINX Configuration for Load Balancing
- Create file /etc/nginx/sites-available/api
- Configure as follows
upstream backend {
least_conn;
server host1:8080; # The name of the server shall be changed as appropriate
server host2:8080;
server host3:8080;
}
server {
server_name obptest.com www.obptest.com; # The server name should be changed as appropriate
access_log /var/log/nginx/api.access.log;
error_log /var/log/nginx/api.error.log;
location / {
proxy_pass http://backend/;
}
location /obp/v2.1.0/sandbox/data-import {
proxy_pass http://backend/;
}
}
- Zookeeper/Kafka Cluster Setup
The Zookeeper/Kafka cluster is deployed on 3 nodes. The following configurations need to be done on each of the three nodes
- Zookeeper configuration
- Inside the Kafka directory, edit the file conf/zookeeper.properties and include these lines
dataDir=/home/user/zookeeper
server.1=host1:2888:3888 # The name of the servers shall be changed as appropriate
server.2=host2:2888:3888
server.3=host3:2888:3888
initLimit=5
syncLimit=2
- Create a
myid
file under dataDir which is /home/user/zookeeper in this example
echo “1” > /home/user/zookeeper/myid #Insert unique id’s on each of the machines
- Start the zookpeer daemons on each of the 3 machines
bin/zookeeper-server-start.sh config/zookeeper.properties &
- Kafka Configuration
Inside the Kafka directory, edit the file conf/server.properties and include these lines
broker.id=1 # The broker.id should be unique for each host
num.partitions=4
zookeeper.connect=host1:2181,host2:2181,host3:2181
- Start the kafka broker daemons on all the machines
bin/kafka-server-start.sh config/server.properties &
- Create the topics
bin/kafka-topics.sh --create --zookeeper host1:2181,host2:2181,host3:2181 --replication-factor 1 --partitions 1 --topic Request
bin/kafka-topics.sh --create --zookeeper host1:2181,host2:2181,host3:2181 --replication-factor 1 --partitions 1 --topic Response
- OBP-API Configuration
- Edit the OBP-API/src/main/resources/props/default.props so that it contains the following lines. This should be done on each node.
connector=kafka
kafka.zookeeper_host=localhost:2181
kafka.request_topic=Request
kafka.response_topic=Response
- Start the server
cd OBP-API
mvn jetty:run
OBP-JVM
- Build the package
cd OBP-JVM
mvn install
- Run the demo
java -jar obp-ri-demo/target/obp-ri-demo-2016.9-SNAPSHOT-jar-with-dependencies.jar&
Here be aware that the name of the jar file might be different, so make sure to use the correct name of the jar file
- Run from the command line
cd OBP-Kafka-Python
python server.py
To test the setup, try a request
http://localhost:8080/obp/v2.0.0/banks