H-Sphere Documentation Sysadmin Guide

For more information contact us at info@psoft.net

CP Acceleration

 

Related Docs:  

Backing Up H-Sphere Postgres Installation

When your Control Panel works slow or you have high CPU/memory load, there could be certain ways to accelerate the Control Panel performance.

 

H-Sphere Java-Related Issues

1. Apache JServ Configuration

The following procedure is performed once to set parameters that depend on the server memory size.

1. Stop the Control Panel.

2. Update the jserv.properties file:

vi /hsphere/local/home/cpanel/apache/etc/jserv/jserv.properties

For example, for a server with 512 MB RAM the following parameters should be set:

wrapper.bin.parameters=-Xms64M -Xmx512M

3. Start the Control Panel.

 

2. NFU Cache Optimization

NFU cache parameters have to be set depending on your server memory size and the number of accounts and domains in your system. If a lot of new accounts/domains are added to H-Sphere, we recommend to reconfigure NFU cache as follows:

1. Stop the Control Panel.

2. Set NFU parameters in hsphere.properties.

Check hsphere.log for NFU messages:

grep NFU /var/log/hsphere/hsphere.log

You would receive the lines like these:

2003-02-26 08:08:29,190 [Thread-11] DEBUG psoft.hsphere.CP - Resource NFU cache:initial size:5000 size:142 max size:5000 rate:0.0
2003-02-26 08:08:29,190 [Thread-11] DEBUG psoft.hsphere.CP - ResourceId NFU cache:initial size:25000 size:161 max size:25000 rate:0.87
2003-02-26 08:08:29,190 [Thread-11] DEBUG psoft.hsphere.CP - SharedObject NFU cache:initial size:5000 size:0 max size:5000 rate:0.0

Here, you should pay attention to the "size" and "rate" parameters. If the "initial size" is close to the "max size" and rate is lower than 0.75, it is appropriate to increase the size of NFU cache. For this, you need to insert two parameters to hsphere.properties:

NFU_CACHE_MULTIPLIER = 5
NFU_CACHE_MULTIPLIER_MAX = 10

In this example, cache size would increase five times, and if necessary (e.g., for accounting) it could be increased ten times.

3. Start the Control Panel.

 

H-Sphere System Database Optimization

H-Sphere Database Settings

1. Converting Bigint to Int4

Skip this procedure if you have performed the Postgres upgrade to 7.3 version.

Postgres migration from int8 to int4 is very effective if you host more than 500 accounts. (By default, Postgres can't index fields of the int8 type.)

You need to perform it once at any time.

For this procedure, find the partition with sufficient amount of free space.

1. Stop the Control Panel (check hsphere.log that no crons are running)

2. Export schema:
pg_dump -u -s -f db_old.db hsphere
cp db_old.db db.db

3. Convert int8 to int4:
vi db.db
In vi, change every instances of bigint and int8 to int4 by typing the following commands:
%s/bigint/int4/g
%s/int8/int4/g

4. Then, in the l_server_ips table and its index, change type back to int8 for the ip_num column:
ip_num int4 NOT NULL - change int4 to int8;
CREATE  INDEX "l_server_ips_numkey" on "l_server_ips" using btree ( "ip_num" "int4_ops" ); - change int4_ops to int8_ops.

5. Export Data:
pg_dump -u -a -f data.db hsphere

6. Recreate DB:
dropdb -U wwwuser hsphere
createdb -U wwwuser hsphere

7. Create Schema: psql -q -U wwwuser -f db.db hsphere

8. Import Data *:
psql -q -U wwwuser -f data.db hsphere

9. Start the Control Panel.

 

2. Updating Moddb (for H-Sphere versions 2.3 RC4 and higher)

Moddb is one of the scripts included in the H-Sphere update. However, it is not automatically performed during the H-Sphere installation. You should launch it manually and only once. To do this:

Note: Prior to running moddb, update your H-Sphere to the latest version.

1. Stop the Control Panel.

2. Make moddb:

- Download the H-Sphere 2.3 update (to the version you have installed)
- Run the update script:
#sh ./U23P3 (H-Sphere version 2.3 Patch 3 update script)
- choose moddb.

This option will back up old H-Sphere database and modify H-Sphere DB scheme (increase some fields length, e.g: email, notes, suspend/resume reason etc).
Note: You may be prompted for your H-Sphere DB password under Postgres versions starting from 7.2.x. Enter the password to complete the procedure.

3. Start the Control Panel.

 

Postgres System Settings

1. Performing VACUUM

VACUUM should be performed regularly (e.g., once a week). You may put the corresponding script into cron.

Mind, however, that this procedure requires a lot of system resources and creates a high server load.

We recommend you to back up the database before performing vacuumdb. Be careful: if the server gets down during this process, some data may be lost!

To backup your system database, run the hs_bck script:
/hsphere/shared/scripts/cron/hs_bck,
or
cd /hsphere/shared/backup
./hs_bck

Do the following procedure to apply VACUUM to your system:

  • Log into the server as root:
    su - postgres (or su - pgsql for FreeBSD)
  • Connect to the database:
    psql -U wwwuser -d hsphere
  • Do vacuum:
    hsphere$ vacuum full;
    (or vacuum analyze;, or vacuum;, depending on the PostgreSQL server version)
 

2. Optimizing Postgres Memory Usage

You may reduce memory resources used for Postgres by modifying the sort_mem and shared_buffers parameters in the postgresql.conf file.

1. Stop the Control Panel.

2. Stop Postgres.

3. Modify the postgresql.conf file:

su - postgres (su - psql in FreeBSD)
cd data
vi postgresql.conf

You would get the line similar to these (values are in kilobytes):

sort_mem = 32168
shared_buffers = 65536

Increase the size of memory used by the PostgreSQL server according to the PostgreSQL documentation.

4. Start Postgres and make sure it's working properly. If parameters are incorrect, Postgres might not start. In this case, please also set the SHMALL and SHMMAX kernel parameters according to the rules described in the RedHat documentation.

5. Start the Control Panel.

 

3. Updating Postgres to the Latest Version

If your Postgres version is earlier than 7.3, update Postgres to version 7.3. This version works faster and uses the server memory much more effectively. Also, security problems of the previous versions have been fixed in it.

  1. Stop the Control Panel.
  2. Dump the H-Sphere system database.

    Export schema:
    pg_dump -u -s -f db_old.db hsphere
    cp db_old.db db.db

    Export data:
    pg_dump -u -a -f data.db hsphere

  3. Dump SiteStudio databases and other databases.
    Usually, it requires to dump the following SiteStudio databases: counter, poll, guestbook. If you have any other databases, you could back them up, too. You may perform the backup by the pg_dump command.
  4. It is advisable that you validate or check the databases dump to make sure you'll be able to recover data after the upgrade. You could make more than one backup.
    IMPORTANT: It is highly recommended that you backup your databases into a directory other than your Postgres home directory so that you would not lose data during Postgres update/install/uninstall procedure.
  5. Stop Postgres.
  6. Upgrade the Postgres RPMs (or packages under FreeBSD).
    Or, you can perform the update in two steps:
    - uninstall the old Postgres RPMs (packages);
    - install the new Postgres RPMs (packages).
    Note: It is recommended to install Postgres with multilingual support.
  7. Create the H-Sphere Postgres DB user (usually, wwwuser) and set the password which is set in the ~cpanel/shiva/psoft_config/hsphere.properties file.
    1. Start Postgres
    2. Enter as the postgres user:
      su - postgres (or, psql for FreeBSD)
    3. Create wwwuser:
      createuser wwwuser
    4. Configure wwwuser password according to the instructions in Step 4 of the Postgres Installation document.
    5. Stop Postgres
  8. Optimize the H-Sphere database schema.
    1) Convert int8 to int4
    2) Change the type of l_server_ips.ip_num back to int8
  9. Start Postgres.
  10. Recreate the H-Sphere database:
    1) create database:
    createdb -U wwwuser hsphere
    2) create schema:
    psql -q -U wwwuser -f db.db hsphere
    3) import data *:
    psql -q -U wwwuser -f data.db hsphere
  11. Recreate SiteStudio and other databases from the dump files.
  12. Start the Control Panel.
 

Troubleshooting

Sometimes while importing data you may get the message like this:

----------------------------------
psql:data.db:527111: ERROR:  copy: line 422025, Bad float8 input format -- underflow
psql:data.db:527111: PQendcopy: resetting connection
----------------------------------
	

This means that Postgres can't interpret data it has just exported.

You need to open the data.db file:
vi data.db
and remove the line which number is calculated in the example above as N=527111+422025. This line would contain a float8 number like 1.2e-318. After removing that line, you need to recreate and reload the database.


Related Docs:  

Backing Up H-Sphere Postgres Installation



Home   Products   Services   Partners   Support   News   Contact   Forum
© Copyright 1998-2003. Positive Software Corporation.
All rights reserved.