HTTP-backend

From ISPWiki

Jump to: navigation, search

Contents

Prerequisite

If the second interface is not present on the network interface, jump this step.

Open /etc/network/interfaces

 # nano /etc/network/interfaces

to add the following lines

 auto ethX
 iface ethX inet static
     address 10.0.0.7
     netmask 255.0.0.0

where X is the network interface number.

Run the following command to apply the changes:

 # /etc/init.d/networking restart

Installing and customizing libnss-extrausers

Install additional modules for the NSS service that will provide the system with user and group information from the files:/var/lib/extrausers/passwd, /var/lib/extrausers/shadow и /var/lib/extrausers/groups.

 # apt-get install libnss-extrausers

Open /etc/nsswitch.conf

 # nano /etc/nsswitch.conf

and change the passwd, group and shadow options

 ...
 passwd: compat extrausers
 group:  compat extrausers
 shadow: compat extrausers
 ...

Installing and customizing sshfs

Install the utility for working with the network file system via SSH:

 # apt-get install sshfs

Open /etc/rc.local

 # nano /etc/rc.local

and add the line

 /usr/bin/sshfs 10.0.0.1:/storage/etc /var/lib/extrausers

where 10.0.0.1 is the storage serevr floating IP-address.

Create the /root/.ssh directory:

 # mkdir /root/.ssh

Get a SSH serve public key:

 # ssh root@10.0.0.1 "cat /root/.ssh/id_rsa.pub"

Open /root/.ssh/known_hosts

 # nano /root/.ssh/known_hosts

to add the line

 10.0.0.1 X

where X is the SSH server public key.

Create a SSH public key:

 # ssh-keygen -t rsa -f /root/.ssh/id_rsa -N ""

Get the SSH public key

 # cat /root/.ssh/id_rsa.pub

and add it on the list of authorized keys

 # ssh root@10.0.0.1 "echo \"X\" >> /root/.ssh/authorized_keys"

where X is a local SSH public key.

You have exchanged public keys with the storage server.

Installing and customizing the NFS-server

Install the utility for the NFS-server:

 # apt-get install nfs-common

Open /etc/default/nfs-common

 # nano /etc/default/nfs-common

to change the NEED_IDMAPD option

 ...
 NEED_IDMAPD="yes"
 ...

Open /etc/idmapd.conf

 # nano /etc/idmapd.conf

to change the Domain option in the General section and Method in the Translation section

 [General]
 Domain = cluster.lan
 ...
 [Translation]
 Method = nsswitch
 ...

Restart the NFS-server with the command:

 # /etc/init.d/nfs-common restart

Configuring the SSH-server

Open /etc/ssh/sshd_config

 # nano /etc/ssh/sshd_config

to change the Port option

 ...
 Port 222
 ...

for the SSH-server that runs from the server not to conflict with the Master node SSH-server.

Restart the SSH-server with the command:

 # /etc/init.d/ssh restart

Connecting the storages

Create the following directories for connecting the storage:

 # mkdir -p /storage \
            /var/run-cluster/mysqld \
            /var/run-cluster/apache2 \
            /var/cluster/spool/exim4 \
            /var/cluster/log/account \
            /var/cluster/lib/exim4 \
            /var/httpd-logs

Open /etc/fstab

 # nano /etc/fstab

to add the line

 10.0.0.1:/ /storage nfs4 rw,rsize=65000,wsize=65000,proto=tcp,soft,intr,noatime,noauto,actimeo=240,acregmin=10,acdirmin=30,timeo=50,async 0 0

Open /etc/rc.local

 # nano /etc/rc.local

to add the following lines

 /bin/mount /storage
 /bin/mount --bind /dev /storage/dev
 /bin/mount --bind /dev/pts /storage/dev/pts
 /bin/mount --bind /proc /storage/proc
 /bin/mount --bind /tmp /storage/tmp
 /bin/mount --bind /lib/modules /storage/lib/modules
 /bin/mount --bind /var/run-cluster /storage/var/run
 /bin/mount --bind /var/cache/debconf /storage/var/cache/debconf
 /bin/mount --bind /var/cluster/spool/exim4 /storage/var/spool/exim4
 /bin/mount --bind /var/cluster/log/account /storage/var/log/account
 /bin/mount --bind /var/cluster/lib/exim4 /storage/var/lib/exim4
 /bin/mount --bind /var/httpd-logs /storage/home/httpd-logs

Connect the storages:

 # chmod +x /etc/rc.local && /etc/rc.local

Configuring the HTTP-backup

Add the ISPmanager Cluster public key on the list of authorized keys:

 # mkdir /root/.ssh && cat /storage/usr/local/ispmgr/etc/ssh-key.pub >> /root/.ssh/authorized_keys

Register the HTTP-backend in ISPmanager Cluster. Go to the "Tools" section -> "Backends" to add an HTTP-node. Enter the node's internal IP-address and the cluster's password:

Register web-servers for the newly created backend:

Open the /etc/rc.local file

 # nano /etc/rc.local

and add the following lines

 /usr/sbin/chroot /storage /etc/init.d/openntpd start
 /usr/sbin/chroot /storage /usr/local/ispmgr/etc/cluster_roles/init.d/ntpdate start
 /usr/sbin/chroot /storage /etc/init.d/exim4 start
 /usr/sbin/chroot /storage /etc/init.d/acct start
 /usr/sbin/chroot /storage /etc/init.d/ssh start
 /usr/sbin/chroot /usr/local/ispmgr/sbin/sitectl start local

Start the web-servers:

 # chroot /storage usr/local/ispmgr/sbin/sitectl start local

Notes

Execute the following command to distribute users' WWW domains among backends of the chroot-environment

 # /usr/local/ispmgr/sbin/sitectl distribute

Specify the MinServersPerHost parameter of the configuration file to define the number of web-server, on which WWW domain should be present.

Was this helpful? Yes | No
Personal tools