Showing posts with label install. Show all posts
Showing posts with label install. Show all posts

Sunday, November 21, 2010

GlassFish 2 Cluster Configuration on the Same Machine

This tutorial will guide you through a GlassFish 2.1.1 Cluster with two instances on the same machine. We are going to use the CLI interface to make our life simpler.
[Whenever you encounter the \ symbol in one of the commands, it means that the command continues on the following line. So you have to copy both lines (including the \ symbol) at your terminal.]
After a successful installation of glassfish with cluster profile (setup-cluster.xml), as explained on the download page:

https://glassfish.dev.java.net/downloads/v2.1.1-final.html

Go to directory ${GF_HOME}/bin and delete default domain domain1 (or you can just ignore it).
asadmin delete-domain domain1
and create a new domain with adminport 4000, name das :
asadmin create-domain --adminport 4000 --profile cluster das
Use the following credentials (or your own, just make sure to make the changes on the password file later on)
Admin user : admin
Admin pass : admin111
Master pass : admin111
We are going to use a password file inside ${GF_HOME}/bin in order to make the steps quicker with the following three lines :
AS_ADMIN_ADMINPASSWORD=admin111
AS_ADMIN_PASSWORD=admin111
AS_ADMIN_MASTERPASSWORD=admin111
You should better change the file preferences so that no one else can view this file except the GF admin:
chmod 600 passwords
First step is to start the new domain:
asadmin start-domain --user admin --passwordfile passwords das
Create the first node agent, connecting on DAS at 4000 port, (and then start it):
asadmin create-node-agent --user admin --port 4000 \
   --passwordfile passwords agent1
asadmin start-node-agent --user admin --passwordfile passwords agent1
Create the cluster farm named cl1 (connecting on DAS at 4000 port) that will group both of the clustered instances:
asadmin create-cluster --user admin --passwordfile passwords \
   --port 4000 cl1
Create the first instance (gf1 on http port 9080) and the second instance (gf2 on http port 9090) that communicate to the domain (DAS on port 4000) through the node agent (agent1) and reference our cluster (cl1):
asadmin create-instance --user admin --passwordfile passwords \
   --port 4000 --nodeagent agent1 --systemproperties \
   HTTP_LISTENER_PORT=9080 --cluster cl1 gf1
and
asadmin create-instance --user admin --passwordfile passwords \
   --port 4000 --nodeagent agent1 --systemproperties \
   HTTP_LISTENER_PORT=9090 --cluster cl1 gf2
Last step is to start the cluster and the instances with the following command:
asadmin start-cluster --user admin --port 4000 \
   --passwordfile passwords cl1
Now when you point your browser to http://localhost:4000/ and login as admin/admin111 you will see on your left the "Clusters" Task, with cl1 child. And cl1 will have two children gf1 and gf2. To deploy an application to the cluster, all you need to do is remove the target "server" and add the target "cl1" (either at deployment or after deployment).
You will also see the "Node Agents" Task that has the agent1 node agent.
Here are the startup commands :
asadmin start-domain --user admin --passwordfile passwords das
asadmin start-node-agent --user admin --passwordfile passwords agent1
asadmin start-cluster --port 4000 --passwordfile passwords cl1
and the shutdown commands:
asadmin stop-cluster --user admin --passwordfile passwords cl1
asadmin stop-node-agent agent1 
asadmin stop-domain das


p.s.
Here are all the commands one after another in order to run them as a script:

asadmin create-node-agent --user admin --port 4000 --passwordfile passwords agent1
asadmin start-node-agent --user admin --passwordfile passwords agent1
asadmin create-cluster --user admin --passwordfile passwords --port 4000 cl1
asadmin create-instance --user admin --passwordfile passwords --port 4000 \
  --nodeagent agent1 --systemproperties HTTP_LISTENER_PORT=9080 --cluster cl1 gf1
asadmin create-instance --user admin --passwordfile passwords --port 4000 \
  --nodeagent agent1 --systemproperties HTTP_LISTENER_PORT=9090 --cluster cl1 gf2
asadmin start-cluster --user admin --port 4000 --passwordfile passwords cl1
And the shutdown-delete commands in order to clean up your installation.

asadmin stop-cluster --user admin --passwordfile passwords cl1
asadmin stop-node-agent agent1 
asadmin delete-instance --user admin --passwordfile passwords --port 4000 gf1
asadmin delete-instance --user admin --passwordfile passwords --port 4000 gf2
asadmin delete-cluster --port 4000 --user admin --passwordfile passwords cl1
asadmin delete-node-agent agent1
asadmin delete-node-agent-config --port 4000 --user admin --passwordfile passwords agent1
asadmin stop-domain das
asadmin delete-domain das


p.s.
You can find me on fiverr for more personalized requests on any java app server configuration problem or java error that you encounter, with deliverance of less than a day (true!) and money back guarantee if not satisfied.

Tuesday, May 18, 2010

Cuda 3.0 installation on Ubuntu Linux 10.04

I need to point out, that it is somewhat appalling the need to write a new tutorial for every time either a linux version or a product (pick your favourite) version is released. That said, I am off to provide the tutorial.

I had to read many tutorials and walkthroughs, as well as forum threads to succeed in the installation. So some parts might look very familiar!

First of all we will need to install the cuda graphics driver. Afterwards the cuda toolkit, followed by the cuda sdk. Finally we 'll install gcc 4.3 beacuse Cuda cannot cooperate with gcc 4.4 with which Ubuntu 10.04 ships. The linux version I am using is i386. I presume the instructions will work as well with x86_64 kernel.

Go to the official nvidia-CUDA download page:
http://developer.nvidia.com/object/cuda_3_0_downloads.html#Linux

Download the CUDA Toolkit and the CUDA SDK:

CUDA Toolkit for Ubuntu Linux 9.04 (32-bit)
GPU Computing SDK code samples and more

-----------------------------
Installing the NVIDIA driver:
-----------------------------
We'll need the latest cuda development driver available (195.xx), but first we'll uninstall the existing drivers.

1. Uninstall existing NVIDIA drivers and nvidia-glx.

(if you have enabled nvidia in system->administration->hardware drivers, then disable them first and possibly reboot)

sudo apt-get purge nvidia-*

2. Stop gdm service by running

sudo service gdm stop

3. Install drivers from nvidia repository

sudo add-apt-repository ppa:nvidia-vdpau/ppa
sudo apt-get update
sudo apt-get install nvidia-185-modaliases nvidia-glx-185 nvidia-settings
sudo nvidia-xconfig

4. Reboot and log back in.

5. Run

nvidia-settings

to verify that your driver version is at least 195. Look for the driver version in the window:
The 195.xx NVIDIA Driver for use with CUDA.

----------------------------
Installing the CUDA Toolkit:
----------------------------

After having installed the driver we now need to install the CUDA toolkit itself.

1. Run:

sudo sh cudatoolkit_3.0_linux_32_ubuntu9.04.run

2. Press enter to install at the default location.

/usr/local/cuda

3. Register the new library files:

sudo gedit /etc/ld.so.conf.d/cuda.conf &

and add the following to the empty file

/usr/local/cuda/lib

Save the file and close gedit.
Then run:

sudo ldconfig

Create a link to the libcuda.so library:

cd /usr/lib
sudo ln -s nvidia-current/libcuda.so libcuda.so

Also add to the end of your ~/.bashrc file.

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib

restart bash

----------------------------------------------------------
Installing the CUDA SDK and Compiling the Example Programs
----------------------------------------------------------

We will now install the CUDA SDK to our own home directory (we can experiment with the supplied demos):

1. Install SDK to the default location

sh gpucomputingsdk_3.0_linux.run

2. As CUDA does not yet work with GCC 4.4 we will have to install gcc-4.3:

sudo apt-get install gcc-4.3 g++-4.3 g++-4.4
sudo update-alternatives --remove-all gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 43 --slave /usr/bin/g++ g++ /usr/bin/g++-4.3 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.3
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 44 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.4
sudo update-alternatives --config gcc ### choose gcc 4.3

3. Install CUDA SDK requirements

sudo apt-get install libglut3-dev libxi-dev libxmu-dev

4. Go to SDK source dir:

cd ~/NVIDIA_GPU_Computing_SDK/C$

5. You should now be able to compile everything by running

make

This should now compile all the examples in the SDK without errors.

---------------------------------------------
Verify Installation
---------------------------------------------

We can now verify that everything is working:

1. Run (from ~/NVIDIA_GPU_Computing_SDK/C):

bin/linux/release/deviceQuery

On my machine I get the following output (depending on your harware, you output may be different. mine is a GeForce 8500 GT):

------------------------------------------------
bin/linux/release/deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

There is 1 device supporting CUDA

Device 0: "GeForce 8500 GT"
CUDA Driver Version: 3.0
CUDA Runtime Version: 3.0
CUDA Capability Major revision number: 1
CUDA Capability Minor revision number: 1
Total amount of global memory: 536150016 bytes
Number of multiprocessors: 2
Number of cores: 16
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 16384 bytes
Total number of registers available per block: 8192
Warp size: 32
Maximum number of threads per block: 512
Maximum sizes of each dimension of a block: 512 x 512 x 64
Maximum sizes of each dimension of a grid: 65535 x 65535 x 1
Maximum memory pitch: 2147483647 bytes
Texture alignment: 256 bytes
Clock rate: 1.57 GHz
Concurrent copy and execution: Yes
Run time limit on kernels: Yes
Integrated: No
Support host page-locked memory mapping: No
Compute mode: Default (multiple host threads can use this device simultaneously)

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 134566327, CUDA Runtime Version = 3.0, NumDevs = 1, Device = GeForce 8500 GT


PASSED

Press to Quit...
-----------------------------------------------------------
-----------------------------------------------------------

That was it. It was a little hard, but it is worth the effort.

Let us only hope that we will not be obligated to write a new one for every release!!!