Ejabberd XMPP messaging server comes with a few modules with the initial installation. Some of these are useful however you can extend the features of the server a lot more by using additional modules.
There are a number of modules that can be downloaded from https://svn.process-one.net/ejabberd-modules/ , also there are a number of custom modules on the net, or you can even write your own; if you know erlang.
For example if you wanted some more useful user statistics for your server, rather than just the basic Statistics tab from the web admin page, that just gives you the following details:
Registered Users
Online Users
Outgoing s2s Connections
Outgoing s2s Servers
Why not install the statsdx module that gives you a lot more information.
All modules are installed into the /opt/ejabberd-2.1.5/lib/ejabberd-2.1.5/ebin directory however each module will have it's own set-up requirements written in the README.txt available in each module trunk directory.
To install statsdx :
change to /opt/ejabberd-2.1.5/lib/ejabberd-2.1.5 directory
run svn co https://svn.process-one.net/ejabberd-modules/ to get the latest modules
cd ejabberd-modules/mod_statsdx/trunk
run ./build.sh
copy generated beam file(s) from trunk/ebin directory to
/opt/ejabberd-2.1.5/lib/ejabberd-2.1.5/ebin
edit /opt/ejabberd-2.1.5/conf/ejabberd.cfg:
Scroll down to the section headed modules, this is where you enable each module on your server.
Append the following the the end of the enable modules:
{mod_statsdx, [{hooks, true}]}
(as instructed in the README.txt available with the module src files)
run ./opt/ejabberd-2.1.5/bin/ejabberdctl restart to restart the server instance
Browse to http://localhost:5280/admin/ to see you have more stats available under the Statistics DX tab, such as:
Registered Users
Roster Details
User details
MUC information
Sessions per client, OS, connection type, Languages
There are a lot more modules you can use to extend your basic Ejabberd installation, depending on what you want to do or know.
Monday, 17 January 2011
Sunday, 2 January 2011
Installing GlassFish application Server cluster on Linux
GlassFish is a Java EE open source application server. The following instructions demonstrate how to install GlassFish 2.1.1 on any Linux platform.
http://glassfish.java.net/javaee5/build/GlassFish_LB_Cluster.html contains full information on downloading and installing glassfish clusters and load balancer plugin.
I am going to explain the steps I took to install glassfish clusters as I didn't require load balance support.
Please note all commands will require elevated privileges.
1. Download binary installer from http://glassfish.java.net/downloads/v2.1.1-final.html
save to /opt directory.
2. Ensure JAVA_HOME variable is set to JDK directory
3. Within the /opt directory run java -Xmx256m -jar glassfish-installer-v2.1.1-b31g-linux.jar
INSTALLATION COMPLETE is displayed
This UN-bundles glassfish and installs under a new directory 'glassfish'
4. Change to glassfish directory cd glassfish/
5. Change permissions on lib/ant/bin sub directory using chmod -R +x lib/ant/bin
6. Run lib/ant/bin/ant -f setup-cluster.xml . If successful you get BUILD SUCCESSFUL displayed
7. From /opt/glassfish/bin run ./asadmin start-domain domain1 to start to default domain.
Domain [domain1] is running is displayed
8. Browse to http://localhost:8080/ to confirm Enterprise server is now running.
9. Browse to http://localhost:4848/ to access admin console. Default user name and password are username: admin, password: adminadmin . You can change this from the Application Server settings on the web admin interface page.
The server is now running and now we are going to look at creating a one machine cluster.
10. Change to directory /opt/glassfish/samples/quickstart/clusterjsp
Run /opt/glassfish/bin/asant setup-one-machine-cluster
This does the following:
Creates a cluster with name cluster1
Creates a node-agent with name cluster1-nodeagent
Starts the above
Creates two instances under the cluster
You can change these default values under /opt/glassfish/samples/quickstart/clusterjsp/cluster.properties before running
BUILD SUCCESSFUL is displayed
12. Start the cluster using glassfish/bin/asant start_cluster
BUILD SUCCESSFUL is displayed again
13. View and confirm node with two instances is setup from http://localhost:4848/ select node agent then cluster1-nodeagent on the left pane
If you need to test the two instances you can simply deploy an application in glassfish and browse to the instance using http:localhost:PORT/appname
If you continue reading the link below you can learn how to use the load balancer plugin and set up Sun Java System Web Server for this.
http://glassfish.java.net/javaee5/build/GlassFish_LB_Cluster.html
http://docs.sun.com/app/docs/doc/821-0186/aboaa?a=view - also a useful link for getting started
http://glassfish.java.net/javaee5/build/GlassFish_LB_Cluster.html contains full information on downloading and installing glassfish clusters and load balancer plugin.
I am going to explain the steps I took to install glassfish clusters as I didn't require load balance support.
Please note all commands will require elevated privileges.
1. Download binary installer from http://glassfish.java.net/downloads/v2.1.1-final.html
save to /opt directory.
2. Ensure JAVA_HOME variable is set to JDK directory
3. Within the /opt directory run java -Xmx256m -jar glassfish-installer-v2.1.1-b31g-linux.jar
INSTALLATION COMPLETE is displayed
This UN-bundles glassfish and installs under a new directory 'glassfish'
4. Change to glassfish directory cd glassfish/
5. Change permissions on lib/ant/bin sub directory using chmod -R +x lib/ant/bin
6. Run lib/ant/bin/ant -f setup-cluster.xml . If successful you get BUILD SUCCESSFUL displayed
7. From /opt/glassfish/bin run ./asadmin start-domain domain1 to start to default domain.
Domain [domain1] is running is displayed
8. Browse to http://localhost:8080/ to confirm Enterprise server is now running.
9. Browse to http://localhost:4848/ to access admin console. Default user name and password are username: admin, password: adminadmin . You can change this from the Application Server settings on the web admin interface page.
The server is now running and now we are going to look at creating a one machine cluster.
10. Change to directory /opt/glassfish/samples/quickstart/clusterjsp
Run /opt/glassfish/bin/asant setup-one-machine-cluster
This does the following:
Creates a cluster with name cluster1
Creates a node-agent with name cluster1-nodeagent
Starts the above
Creates two instances under the cluster
You can change these default values under /opt/glassfish/samples/quickstart/clusterjsp/cluster.properties before running
BUILD SUCCESSFUL is displayed
12. Start the cluster using glassfish/bin/asant start_cluster
BUILD SUCCESSFUL is displayed again
13. View and confirm node with two instances is setup from http://localhost:4848/ select node agent then cluster1-nodeagent on the left pane
If you need to test the two instances you can simply deploy an application in glassfish and browse to the instance using http:localhost:PORT/appname
If you continue reading the link below you can learn how to use the load balancer plugin and set up Sun Java System Web Server for this.
http://glassfish.java.net/javaee5/build/GlassFish_LB_Cluster.html
http://docs.sun.com/app/docs/doc/821-0186/aboaa?a=view - also a useful link for getting started
Labels:
application server,
cluster,
glassfish,
installation,
java,
load balance,
SDK,
server
Using PostgreSQL database driver within your Grails applications
By default Grails uses an in-memory database that stores data for your apps within volatile RAM. You can leave this as it is but most programmers like to know that their database is more peristent.
In order to use your own data sources you need to be looking at the DataSource.groovy file within /grails-app/conf directory. Here you specify the database that your application will use.
There are three sections within this file so you can specify different data sources for different purposes: production, test and development. In the example I will demonstrate using a different PostgreSQL database for each purpose however you can use three entirely different products if you wish.
Before you start configuring anything in the DataSource.groovy file ensure that you have completed the following:
1. Ensure PostgreSQL is installed
2. Download PostgreSQL JDBC driver and save it into your applications lib folder.
3. Ensure you have a PostgreSQL user to use for the database connection. If you do not wish to use default user, create new user with createuser command.
4. Create the relevant databases in PostgreSQL that your grails application will use. This can be done simply though PGAdmin or using createdb commands as the PostgreSQL user.
5. Return to the Datasource.groovy config file and use the following settings:
dataSource {
pooled = true
driverClassName = "org.postgresql.Driver"
username = "postgres"
password = "password"
}
hibernate {
cache.use_second_level_cache=true
cache.use_query_cache=true
cache.provider_class='org.hibernate.cache.EhCacheProvider'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop','update'
url = "jdbc:postgresql://localhost:5432/devdb"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:postgresql://localhost:5432/testdb"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:postgresql://localhost:5432/proddb"
}
}
}
Please note that the following are examples of the different database purposes:
In order to use your own data sources you need to be looking at the DataSource.groovy file within /grails-app/conf directory. Here you specify the database that your application will use.
There are three sections within this file so you can specify different data sources for different purposes: production, test and development. In the example I will demonstrate using a different PostgreSQL database for each purpose however you can use three entirely different products if you wish.
Before you start configuring anything in the DataSource.groovy file ensure that you have completed the following:
1. Ensure PostgreSQL is installed
2. Download PostgreSQL JDBC driver and save it into your applications lib folder.
3. Ensure you have a PostgreSQL user to use for the database connection. If you do not wish to use default user, create new user with createuser command.
4. Create the relevant databases in PostgreSQL that your grails application will use. This can be done simply though PGAdmin or using createdb commands as the PostgreSQL user.
5. Return to the Datasource.groovy config file and use the following settings:
dataSource {
pooled = true
driverClassName = "org.postgresql.Driver"
username = "postgres"
password = "password"
}
hibernate {
cache.use_second_level_cache=true
cache.use_query_cache=true
cache.provider_class='org.hibernate.cache.EhCacheProvider'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop','update'
url = "jdbc:postgresql://localhost:5432/devdb"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:postgresql://localhost:5432/testdb"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:postgresql://localhost:5432/proddb"
}
}
}
Please note that the following are examples of the different database purposes:
- Development db is when you use grails run-app to launch you application
- Test db is when you run grails unit and integration tests
- Production db is used when you upload the application to an app server such as glassfish etc.
Labels:
application,
database,
driver,
grails,
jdbc,
postgresql,
proddb
Monday, 13 December 2010
Writing your first Grails Application
Writing your first grails application without the use of an IDE. Ensure grails is installed by running grails from a command prompt, then continue with the steps below to create your first app.
http://www.grails.org/Quick+Start
http://www.grails.org/Quick+Start
Thursday, 9 December 2010
Configure Ejabberd chat server to use PostgreSQL ODBC
In order to make data persistent with in any application you can link it to a PostgreSQL relational database.
As default Ejabberd messaging server uses it's internal Mnesia database.
1. To change the default to use a postgres database we first need to create a new postgresql database on the server (this assumes you have PgSQL installed and configured)
run ./createdb ejabberd
2. Create the tables using the supplied script
./psql ejabberd < /opt/ejabberd-2.1.5/lib/ejabberd-2.1.5/priv/odbc/pg.sql
3. Add a user for the database
./createuser ejabberd
4. Configure ODBC options in ejabberd.cfg:
Scroll down to the section headed Database setup.
edit the following, remove the %% commenting
{odbc_server, {pgsql, "127.0.0.1", "ejabberd", "ejabberd", "yourpassword"}}.
5. Add _odbc to modules you wish to use the odbc database
e.g. mod_offline_odbc instead of mod_offline.
full list in ejabberd user guide
6. Under authentication comment out internal authentication :
%%{auth_method, internal}.
Then un comment {auth_method, odbc}.
7. Register a new user and appear online using PSI client or similar application
8. Add a user to allowed admin access control list in ejabberd.cfg
{acl, admin, {user, "username", "server"}}.
9. Confirm registered user and status in web admin:
http://serverIP:5280/admin/
10. Connect to database using PgAdmin to view tables with data and confirm ejabberd is now using PostgreSQL
As default Ejabberd messaging server uses it's internal Mnesia database.
1. To change the default to use a postgres database we first need to create a new postgresql database on the server (this assumes you have PgSQL installed and configured)
run ./createdb ejabberd
2. Create the tables using the supplied script
./psql ejabberd < /opt/ejabberd-2.1.5/lib/ejabberd-2.1.5/priv/odbc/pg.sql
3. Add a user for the database
./createuser ejabberd
4. Configure ODBC options in ejabberd.cfg:
Scroll down to the section headed Database setup.
edit the following, remove the %% commenting
{odbc_server, {pgsql, "127.0.0.1", "ejabberd", "ejabberd", "yourpassword"}}.
5. Add _odbc to modules you wish to use the odbc database
e.g. mod_offline_odbc instead of mod_offline.
full list in ejabberd user guide
6. Under authentication comment out internal authentication :
%%{auth_method, internal}.
Then un comment {auth_method, odbc}.
7. Register a new user and appear online using PSI client or similar application
8. Add a user to allowed admin access control list in ejabberd.cfg
{acl, admin, {user, "username", "server"}}.
9. Confirm registered user and status in web admin:
http://serverIP:5280/admin/
10. Connect to database using PgAdmin to view tables with data and confirm ejabberd is now using PostgreSQL
Labels:
data,
database,
Ejabberd,
messaging,
odbc,
persistent,
postgresql
Subscribe to:
Posts (Atom)