This topic describes how to create LifeKeeper resources for protected services and applications.
Note: Be sure to create a communication path first (refer to LKCLI Communication Path Creation and Deletion).
Creating File System Resources
The steps for creating file system resources are described below. File system resources provide the capability to switch file systems on shared storage between cluster nodes.
System Configuration
The environment created in this guide is a two-node configuration as shown below.
To create file system resources, the following conditions must be satisfied:
- Shared storage (e.g., iSCSI, Fibre Channel) is physically connected to each node
- A file system has been created using a utility such as mkfs
- The file system can be mounted/unmounted on each node
Perform the following steps on target1
- Mounting a file system
Mount a file system for which you want to create a file system resource.
In the example, /dev/sdb1 is mounted on /mnt/fs. The mount point is /mnt/fs.
[target1]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/centos-root 14034944 6904924 7130020 50% / devtmpfs 929204 0 929204 0% /dev tmpfs 941312 0 941312 0% /dev/shm tmpfs 941312 25948 915364 3% /run tmpfs 941312 0 941312 0% /sys/fs/cgroup /dev/sda1 1038336 148528 889808 15% /boot tmpfs 188264 0 188264 0% /run/user/0 /dev/sdb1 1044132 32992 1011140 4% /mnt/fs
- Creating a resource
Run the following command.
[target1]# lkcli resource create fs --tag fs-tag --mountpoint /mnt/fs
Resource Settings
Item | Input Value |
---|---|
--tag | Tag name |
--mountpoint | Mount point |
- Extending a resource
Run the following command.
[target1]# lkcli resource extend fs --tag fs-tag --dest target2
Resource Settings
*Item | Input Value |
---|---|
--tag | Tag name of the created resource |
--dest | Backup node name |
- Checking the resource
After creating and extending the resource, run the following command.
The resource information is displayed.
[target1]# lkcli status -q LOCAL TAG ID STATE PRIO PRIMARY target1 fs-tag /mnt/fs ISP 1 target1 target1 device28856 36000c292eb0c693b2efb44ed56556636-1 ISP 1 target1 target1 disk28786 36000c292eb0c693b2efb44ed56556636 ISP 1 target1
When you create a file system resource, multiple resources are automatically created with dependencies as shown above.
Creating IP Resources
This section describes how to create an IP resource.
The IP resource creates and protects a virtual IP address that can be switched between cluster nodes.
System Configuration
The environment created in this guide is a two-node configuration as shown below.
Prepare a virtual IP address that can be pinged (10.1.6.100 in the above figure).
Also prepare a system that can be pinged (10.1.6.90 in the above).
Check for a ping response using the following command:
# ip -4 addr add 10.1.6.100/24 dev ens192 # ping -c3 -I 10.1.6.100 10.1.6.90
There should be a ping response.
Once the ping response is verified, remove the IP address from the interface.
# ip -4 addr delete 10.1.6.100/24 dev ens192
Restrictions:
- Make sure that the virtual IP address you are trying to create is unique.
- Make sure that there is a system (other than the cluster nodes) that can respond to pings on the same network as the virtual IP address.
Note: IP resources use ping to validate the health of the network. Therefore, you need a system outside the cluster that can respond to pings.
Perform the following steps on target1
- Creating a resource
Execute the following command:
[target1]# lkcli resource create ip --tag ip-tag --ipaddr 10.1.6.100
Resource Settings
Item | Input Value |
---|---|
--tag | Tag name |
--ipaddr | Virtual IP address |
- Configuring a ping list
Run the following command to configure a ping list.
[target1]# lkcli resource config ip --tag ip-tag --pinglist 10.1.6.90
Then bring the resource in service.
[target1]# lkcli resource restore --tag ip-tag
- Extending a resource
Execute the following command:
[target1]# lkcli resource extend ip --tag ip-tag --dest target2
Resource Settings
Item | Input Value |
---|---|
--tag | Tag name of the created resource |
--dest | Backup node name |
- Setting up a ping list for the extended resource
Run the following command to set up a ping list for the extended resource as well.
[target1]# lkcli resource config ip --tag ip-tag --pinglist 10.1.6.90 --remote target2
- Checking the resource
After creating and extending the resource, run the following command.
The resource information is displayed.
[target1]# lkcli status -q LOCAL TAG ID STATE PRIO PRIMARY target1 ip-tag IP-10.1.6.100 ISP 1 target1
Creating a PostgreSQL Resource
This section describes how to create a PostgreSQL resource. The PostgreSQL resource provides the functionality to protect PostgreSQL database instances on LifeKeeper nodes.
System Configuration
The environment created in this guide is a two-node configuration as shown below.
Install PostgreSQL ARK in advance.
The environment in this guide is PostgreSQL
- PostgreSQL 9.2.24 is used in this guide.
- Create a PostgreSQL data directory in the file system on the shared storage.
- The PostgreSQL database admin user should use the “postgres” created when the database is initialized.
- Protect a PostgreSQL resource instance with an active/standby configuration.
*Make sure that your system does not fall under any of file system restrictions. See (LifeKeeper Core – Known Issues / Restrictions) for details.
Perform the following steps on target1 and target2
- Installing PostgreSQL
After installing, disable the autostart of the PostgreSQL service as follows:
# systemctl disable postgresql.service
Perform the following steps on target1
- Mounting the file system
Mount the file system in which the data directory will be created, refer to Step 1 in Creating file system resources.
- Creating a data directory
Create a PostgreSQL data directory on the shared disk.
[target1]# mkdir -p /mnt/fs/pgsql/data [target1]# chown -R postgres:postgres /mnt/fs/pgsql
Change the following path described in the /usr/lib/systemd/system/postgresql.service file to the data directory on the shared disk.
Environment=PGDATA=/mnt/fs/pgsql/data
- Database initialization
Execute the following command to initialize the database.
The database is created under the data directory.
[target1]# postgresql-setup initdb
- Starting the PostgreSQL service
Execute the following command to start the PostgreSQL service.
[target1]# systemctl start postgresql.service
- Creating a resource
Execute the following command:
[target1]# lkcli resource create pgsql --tag pgsql-tag --datadir /mnt/fs/pgsql/data --port 5432 --socket /tmp/.s.PGSQL.5432 --dbuser postgres --logfile /tmp/pgsql-5432.lk.log
Resource Settings
Item | Input Value |
---|---|
--tag | Tag name |
--datadir | Absolute path of the directory that contains the PostgreSQL database data |
--port | Port number used by PostgreSQL |
--socket | Path of the socket used by PostgreSQL |
--dbuser | PostgreSQL database administrator user name |
--logfile | Absolute path to the pg_ctl log file used to start and stop PostgreSQL |
- Extending the resource
Execute the following command:
[target1]# lkcli resource extend pgsql --tag pgsql-tag --dest target2
Resource Settings
Item | Input Value |
---|---|
--tag | Tag name of the created resource |
--dest | Backup node name |
- Checking the resource
After creating and extending the resource, run the following command.
The resource information is displayed.
[target1]# lkcli status -q LOCAL TAG ID STATE PRIO PRIMARY target1 pgsql-tag target1.pgsql-5432 ISP 1 target1 target1 /mnt/fs /mnt/fs ISP 1 target1 target1 device17885 36000c292eb0c693b2efb44ed56556636-1 ISP 1 target1 target1 disk17816 36000c292eb0c693b2efb44ed56556636 ISP 1 target1
When a PostgreSQL resource is created, a file system resource is automatically created as shown above.
Post your comment on this topic.