Right now I am running my EJBCA project on single Jboss server using following command
run.sh -c default -b test.mywebsite.net
and it works fine, but now I want to launch my EJBCA application on clustered jboss machines
for this I have read following links
1.1.2. Launching a JBoss AS Cluster
1.1.3. Web Application Clustering Quick Start
then further I read that There are two aspects to setting up web tier clustering:
Configuring an External Load Balancer.
Configuring Your Web Application for Clustering.
now my questions are
When I go with the External Load Balancer. and when I go with second
option
If I go with second option how it will work ? and what will be my -b
option while running this Jboss servers.
because in point 1.1.2 I read that
Two processes can't bind sockets to the same address and port, so we'll have to tell JBoss to use different ports for the two instances.
EJBCA Version :- ejbca_4_0_12
JBOSS Version :- jboss-6.1.0.Final
EDIT 1
right now I am running my server like this
/run.sh -c default -b test.mysite.net
so it will listen on
https://test.mysite.net:8443/ejbca/
now I have to run my application as
Machine 1
./run.sh -c node1 -g DocsPartition -u 239.255.100.100 \
-b test.mysite.net -Djboss.messaging.ServerPeerID=1 \
-Djboss.service.binding.set=ports-default
Machine 2
./run.sh -c node2 -g DocsPartition -u 239.255.100.100 \
-b test.mysite.net -Djboss.messaging.ServerPeerID=2 \
-Djboss.service.binding.set=ports-default
so that I can only access to
https://test.mysite.net:8443/ejbca/
Please can any one explain this In brife so That I can clear with this things Thanks..
When you follow the documentation you mentioned (Scenario 3: Two Nodes on a Single, Non-Multihomed, Server) you have two JBoss instances:
./run.sh -c node1 -g DocsPartition -u 239.255.100.100 \
-b 192.168.0.101 -Djboss.messaging.ServerPeerID=1 \
-Djboss.service.binding.set=ports-default
./run.sh -c node2 -g DocsPartition -u 239.255.100.100 \
-b 192.168.0.101 -Djboss.messaging.ServerPeerID=2 \
-Djboss.service.binding.set=ports-01
They will listen on:
1) http://192.168.0.101:8080
2) http://192.168.0.101:8180
So to which node you will point your browser to reach the cluster? You can't use either of the two if you want failover. You need to configure a load-balancer.
Furthermore JBoss needs to know that it should replicate the http-session. Therefore you need to configure your web application for clustering. Hence you need to configure 1) and 2) not 1) or 2).
The -b x.x.x.x points to a (the) public IP-address of your server.
Related
i have 2 docker file
1. mysql-dockerfile
FROM mysql:5.5
EXPOSE 3306
ENV MYSQL_ROOT_PASSWORD root
ENV MYSQL_DATABASE ToDoList
command used to build dockerfiles are as below
sudo docker build -t mysql-img -f mysql-dockerfile .
sudo docker run -d --name mysqlcontainer -p 3030:3306 mysql-img
2. java-dockerfile
FROM openjdk:8-jre-alpine
EXPOSE 9090
WORKDIR /usr/src
COPY target/*.war todoApp.war
CMD ["java","-jar","todoApp.war"]
command used to build dockerfiles are as below
sudo docker build -t java-img -f java-dockerfile .
docker run --name javacontainer -d -p 4040:9090 java-img
spring boot application consist jdbc url as follow
spring.datasource.url=jdbc:mysql://localhost:3030/ToDoList
i am not able to start project because spring boot application in docker is not able to connect mysql db which is in another container.
one solution i found is to bring two docker container in one docker network or link docker container.
can anyone please suggest good solution, modified docker run command and modified jdbc url.
Put them into one network and use container names as hostnames:
docker network create foo
docker run --network=foo --name mysqlcontainer -d mysql-img
docker run --network=foo --name javacontainer -d java-img
Dont expose ports - they are exposed automatically between containers inside network.
To connect inside, use mysqlcontainer:3306 and javacontainer:9090.
To connect from host, you will need port exposing.
I have a Docker Swarm cluster setup with 3 servers(1 manager and 2 workers).
I started a Postgresql service using the command below:
docker service create --name postgresql \
--mount src=pg_data,dst=/var/lib/postgresql/data/pgdata \
-p 6542:5432 \
-e POSTGRES_USER="user" \
-e POSTGRES_DB="db" \
-e POSTGRES_PASSWORD="pass" \
-e PGDATA=/var/lib/postgresql/data/pgdata \
--constraint 'node.role == manager' \
postgres
I also created the data volume previously:
docker volume create pg_data
Now, I have another service that I want to start, which is basically a Java application that I bundled into a Docker image and I want to connect it to the postgresql service. I tried the following combinations for the url:
jdbc:postgresql://172.18.0.1:5432/db (docker_gwbridge)
jdbc:postgresql://172.17.0.1:5432/db (docker0)
jdbc:postgresql://localhost:5432/db
jdbc:postgresql://postgresql:5432/db
Any idea what could work?
You shall use a swarm overlay network to connect to your database inside swarm mode.
First create the overlay network:
docker network create -d overlay mynet
Then make your postgresql service use this network:
docker service create --name postgresql \
--mount ... \
--network mynet \
postgres
Then, don't forget to use the same network for your Java application container:
docker service create --name myjavaapp \
--network mynet \
myjavaapp
Then you can connect to your postgresql through DNS name like:
jdbc:postgresql://postgresql:5432/db
All service's containers in the mynet network (you can call it as you want, it's just a name reference), have DNS entries corresponding to service name. This is easier than having to retrieve container's IP through docker inspect before launching your java application.
You can even avoid the publish port -p 6542:5432 in your postgresql docker service as your probably don't want to expose this to others.
You can have a look at the official doc to better understand networks in swarm mode.
This SO QA also talks about overlay network.
Instead of dst=/var/lib/postgresql/data/pgdata try target target=/var/lib/postgresql/data
I have written jenkins job for deploying my package into one of my servers. Am using debian package management system. Am updating all the packages of machine by sudo apt-get update command and installing the required package by sudo apt-get install package_name in a deployment_script (where we make .deb file and specify servers to install). Also am copying the script am using to start / stop package to /etc/init.d/package_name. This script can take parameters start / stop. In my debian postinst script I have mentioned /etc/init.d/package_name start to start the package. For deploying I'll just trigger the jenkins job and give deployment_script to the job. It can install package, then calling postinst script where it restart service properly as well in the intended machine. But while exiting postinst script the restarted service getting killed. Any help on finding the reason and how to fix it?
Am starting my service like sudo -u user_name java -server some_vm_options with jar of the package, configs > /dev/null &.
I just changed it to sudo -u user_name nohup java -server some_vm_options with jar of the package, configs > /dev/null &. Now my started service doesn't get killed.
I am trying to run ignite in a Docker container (Mac OS X, Docker 1.9.1) as committed in git:
# Start from a Java image.
FROM java:7
# Ignite version
ENV IGNITE_VERSION 1.5.0-b1
WORKDIR /opt/ignite
ADD http://www.us.apache.org/dist/ignite/1.5.0-b1/apache-ignite-fabric-1.5.0-b1-bin.zip /opt/ignite/ignite.zip
# Ignite home
ENV IGNITE_HOME /opt/ignite/apache-ignite-fabric-1.5.0-b1-bin
RUN unzip ignite.zip
RUN rm ignite.zip
# Copy sh files and set permission
ADD ./run.sh $IGNITE_HOME/
RUN chmod +x $IGNITE_HOME/run.sh
CMD $IGNITE_HOME/run.sh
After building it locally to apache/ignite and running the image with following command, the container 'hangs'
docker run --expose=4700-4800 -it -p 47500-47600:47500-47600 -p 47100-47200:47100-47200 --net=host -e "CONFIG_URI=https://raw.githubusercontent.com/apache/ignite/master/examples/config/example-default.xml" apacheignite/ignite-docker
When connecting to the container (docker exec -ti apache/ignite /bin/bash) and running the command in verbose mode via bash, it hangs on org.apache.ignite.startup.cmdline.CommandLineRandomNumberGenerator:
bash -x /opt/ignite/apache-ignite-fabric-1.5.0-b1-bin/bin/ignite.sh https://raw.githubusercontent.com/apache/ignite/master/examples/config/example-default.xml
Output where it hangs:
+ CP='/opt/ignite/apache-ignite-fabric-1.5.0-b1-bin/libs/*:/opt/ignite/apache-ignite-fabric-1.5.0-b1-bin/libs/ignite-indexing/*:/opt/ignite/apache-ignite-fabric-1.5.0-b1-bin/libs/ignite-spring/*:/opt/ignite/apache-ignite-fabric-1.5.0-b1-bin/libs/licenses/*'
++ /usr/bin/java -cp '/opt/ignite/apache-ignite-fabric-1.5.0-b1-bin/libs/*:/opt/ignite/apache-ignite-fabric-1.5.0-b1-bin/libs/ignite-indexing/*:/opt/ignite/apache-ignite-fabric-1.5.0-b1-bin/libs/ignite-spring/*:/opt/ignite/apache-ignite-fabric-1.5.0-b1-bin/libs/licenses/*' org.apache.ignite.startup.cmdline.CommandLineRandomNumberGenerator
Looking at the code of CommandLineRandomNumberGenerator, I don't see anything special, just one line to generate a UUID. Are there other things that are automatically started somehow that causes locking a threat so that the application cannot exit?
This seems to be a docker issue with java in general, see also:
https://github.com/docker/docker/issues/18180
Several solutions possible:
create a docker machine as follows and run it in here (cfr. https://github.com/docker/docker/issues/18180#issuecomment-162568282):
docker-machine create -d virtualbox --engine-storage-driver overlay overlaymachine
Add System.exit(0) explicit at the end of each main method (cfr. https://github.com/docker/docker/issues/18180#issuecomment-161129296)
Wait for next docker patched version (https://github.com/docker/docker/issues/18180#issuecomment-170656525)
I think it would be good practice (for now) to add System.exit to all main methods in Ignite since this is independent of alternative hacks on docker or linux in general (linux kernel need AUFS upgrade and many machine may lag behind before that). This way future Ignite version can safely be installed on older kernels also.
I am trying to run a web application (which is a servlet + gradle project). I am using Jetty to run the application. When I run the application , I am getting the error:
Address already in use
Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.0-bin.zip'.
When, I enter localhost:8080 , I used to get jenkins default page, So I uninstalled jenkins and tried again, but getting the same error.
Please help in resolving this issue, also how do we get to know which application is running on corresponding port?
You can use the command "netstat". Look for the line in which the column "remote address" ends with ":8080".
Depending on the OS you're running:
Windows:
netstat -b -n -a -p TCP
The process is printed above the line.
Linux:
netstat -a -n -p | grep 8080
The process is printed as the last column of the line.