Tuesday, October 25, 2016

Increasing Java Heap Memory Size on Openfire 4.0.3 (Slackware 14.0 and Debian 8.5)

Slackware 14.0
Openfire Version : 4.0.3
Installed location : /opt/openfire

increasing java heap memory size
creating openfire.vmoptions
root:# touch /opt/openfire/bin/openfire.vmoptions

and at this value to openfire.vmoptions (mine is max 1GB), change value as needed.
root:# mcedit /opt/openfire/bin/openfire.vmoptions
-Xms512m
-Xmx1024m

Testing

Start openfire and grep it to see if variable inside openfire.vmoptions used or not.

root:# ps ax | grep -i openfire
13488 pts/1    Sl     1:09 /usr/lib/java/bin/java -server -Dinstall4j.jvmDir=/usr/lib/java -Dexe4j.moduleName=/opt/openfire/bin/openfire -DopenfireHome=/opt/openfire/bin/../ -Dopenfire.lib.dir=/opt/openfire/lib -Dinstall4j.launcherId=22 -Dinstall4j.swt=false -Di4jv=0 -Di4jv=0 -Di4jv=0 -Di4jv=0 -Di4jv=0 -Xms512m -Xmx1024m -Di4j.vpt=true -classpath /opt/openfire/.install4j/i4jruntime.jar:/opt/openfire/lib/bcpg-jdk15on.jar:/opt/openfire/lib/bcpkix-jdk15on.jar:/opt/openfire/lib/bcprov-jdk15on.jar:/opt/openfire/lib/hsqldb.jar:/opt/openfire/lib/javax.websocket-api.jar:/opt/openfire/lib/jtds.jar:/opt/openfire/lib/mail.jar:/opt/openfire/lib/mysql.jar:/opt/openfire/lib/npn-boot.jar:/opt/openfire/lib/openfire.jar:/opt/openfire/lib/postgres.jar:/opt/openfire/lib/slf4j-log4j12.jar:/opt/openfire/lib/startup.jar com.install4j.runtime.launcher.UnixLauncher start e44106de /opt/openfire/bin/../logs/stderror.log /opt/openfire/bin/../logs/stdoutt.log org.jivesoftware.openfire.starter.ServerStarter
16615 pts/1    S+     0:00 grep -i openfire
See -Xms512m -Xmx1024m inside grep command

Debian 8.5
Openfire Version : 4.0.3
Installed location : /usr/share/openfire

root@triton:/var/lib# cat /etc/default/openfire
# Defaults for openfire initscript
# sourced by /etc/init.d/openfire
# installed at /etc/default/openfire by the maintainer scripts

#
# This is a POSIX shell fragment
#

# If you wish to override the auto-detected JAVA_HOME variable, uncomment
# and change the following line.
#JAVA_HOME=/usr/java/default

# Additional options that are passed to the Daemon.
DAEMON_OPTS=""

change to

root@triton:/var/lib# cat /etc/default/openfire
# Defaults for openfire initscript
# sourced by /etc/init.d/openfire
# installed at /etc/default/openfire by the maintainer scripts

#
# This is a POSIX shell fragment
#

# If you wish to override the auto-detected JAVA_HOME variable, uncomment
# and change the following line.
#JAVA_HOME=/usr/java/default

# Additional options that are passed to the Daemon.
# DAEMON_OPTS=""

DAEMON_OPTS="-Xms512m -Xmx1024

Testing

root@triton:/etc/default# ps -ax | grep -i openfire
26071 ?        Sl     0:06 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -Xms512m -Xmx1024m -server -DopenfireHome=/usr/share/openfire -Dopenfire.lib.dir=/usr/share/openfire/lib -classpath /usr/share/openfire/lib/startup.jar -jar /usr/share/openfire/lib/startup.jar  
See -Xms512m -Xmx1024m inside grep command

Before

Before increasing Java Memory to 1GB

After increasing Java Memory to 1GB




Openfire RSA Certificate issue (RSA certificate not valid)

I got this error after moving my openfire database from Slackware 14.0 to Debian 8.5,

but it just simple problem and openfire already have this solution, just follow this step to resolve issue. Now open TLS/SSL Crtificates tab, and Delete ALL certificates there.


Now you should get new certificates


And everything back to normal




Moving Openfire 4.0.3 Embedded Database from Slackware 14.0 to Debian 8.5

Slackware 14.0

embedded-db location is at  /opt/openfire/embedded-db/ that because im installing Openfire at directory /opt

root:# ls -al /opt/openfire/embedded-db/
total 172672
drwxr-xr-x  2 root root      4096 Oct 24 13:26 ./
drwxr-xr-x 12 root root      4096 Sep  5 09:52 ../
-rw-r--r--  1 root root        16 Oct 24 13:35 openfire.lck
-rw-r--r--  1 root root   4236557 Oct 24 13:35 openfire.log
-rw-r--r--  1 root root       410 Oct 24 13:26 openfire.properties
-rw-r--r--  1 root root 172378422 Oct 24 13:26 openfire.script

Basicly embedded openfire database is only script, yes it just one script contains many SQL command, and that script is openfire.script inside directory embedded-db.

Okay, before we doing backup for directory embedded-db, we must stop openfire service.
root:# /etc/rc.d/rc.openfire stop

Then zip it using zip tool
root:# zip -r embedded-db.slackware.zip embedded-db/
updating: embedded-db/ (stored 0%)
  adding: embedded-db/openfire.properties (deflated 42%)
  adding: embedded-db/openfire.script (deflated 89%)
  adding: embedded-db/openfire.lck (stored 0%)

And you will get embedded-db.slackware.zip (you can use another name) and copy embedded-db.slackware.zip  to Debian 8.5.


Debian 8.5 
embedded-db location is at /usr/share/openfire/ but linked to /var/lib/openfire/embedded-db/

root@triton:~# ls -al /var/lib/openfire/embedded-db/
total 21104
drwxr-x--- 2 openfire openfire     4096 Oct 23 08:20 .
drwxr-x--- 5 openfire openfire     4096 Sep 28 12:54 ..
-rw-r--r-- 1 openfire openfire       16 Oct 23 08:48 openfire.lck
-rw-r--r-- 1 openfire openfire 12878456 Oct 23 08:48 openfire.log
-rw-r--r-- 1 openfire openfire      410 Oct 23 08:20 openfire.properties
-rw-r--r-- 1 openfire openfire  8706332 Oct 23 08:20 openfire.script

Okay, before we doing backup for directory embedded-db, we must stop openfire service.
root@triton:# /etc/init.d/openfire stop

Then zip it using zip tool
root@triton:/var/lib/openfire# zip -r embedded-db.debian.zip embedded-db
  adding: embedded-db/ (stored 0%)
  adding: embedded-db/openfire.properties (deflated 43%)
  adding: embedded-db/openfire.script (deflated 58%)

Delete directory embedded-db
root@triton:/var/lib/openfire# rm -Rf embedded-db

root@triton:/var/lib/openfire# ls -al
total 22484
drwxr-x---  4 openfire openfire     4096 Oct 23 09:05 .
drwxr-xr-x 57 root     root         4096 Sep  7 22:24 ..
-rw-r--r--  1 root     root     19350774 Oct 24  2016 embedded-db.slackware.zip
-rw-r--r--  1 root     root      3652635 Oct 23 09:03 embedded-db.debian.zip
drwxr-xr-x  3 openfire openfire     4096 Sep 28 12:54 .java
drwxr-x--- 18 openfire openfire     4096 Sep  8 00:07 plugins

Now unzip embedded-db.slackware.zip
root@triton:# unzip embedded-db.slackware.zip

make it become openfire owner with this command
root@triton:/var/lib/openfire# chown openfire:openfire embedded-db -R

Start debian openfire with this command
root@triton:# /etc/init.d/openfire start


open your openfire server at : http://your.openfire.url:9090 and change this value
server --> server manager --> system properties -->xmpp.domain
server --> server manager --> system information-->edit properties (button - left bottom) --> server name

After moving database from one server to another server maybe you will get RSA Certificate issue (RSA certificate not valid), follow this step to resolve it.