OpenStack Bobcat : Trove उपयोग कैसे करें2023/10/10 |
Trove का उपयोग इस प्रकार करें।
यह उदाहरण निम्न प्रकार से पर्यावरण पर आधारित है।
------------+--------------------------+--------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.50 eth0|10.0.0.51 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ dlp.srv.world ] | | [ network.srv.world ] | | [ node01.srv.world ] | | (Control Node) | | (Network Node) | | (Compute Node) | | | | | | | | MariaDB RabbitMQ | | Open vSwitch | | Libvirt | | Memcached Nginx | | Neutron Server | | Nova Compute | | Keystone httpd | | OVN-Northd | | Open vSwitch | | Glance Nova API | | Nginx iSCSI Target | | OVN Metadata Agent | | Cinder API | | Cinder Volume | | OVN-Controller | | | | Trove Services | | | +-----------------------+ +-----------------------+ +-----------------------+ |
[1] | ट्रोव के लिए एक VM छवि डाउनलोड करें और इसे Glance में जोड़ें। [trove.conf] में कॉन्फ़िगर किया गया Cinder वॉल्यूम प्रकार भी बनाएं। |
root@dlp ~(keystone)# wget https://tarballs.opendev.org/openstack/trove/images/trove-master-guest-ubuntu-jammy.qcow2
root@dlp ~(keystone)#
root@dlp ~(keystone)# openstack image create Trove-Ubuntu --file=trove-master-guest-ubuntu-jammy.qcow2 --disk-format=qcow2 --container-format=bare --tag=trove --private
openstack image list +--------------------------------------+--------------+--------+ | ID | Name | Status | +--------------------------------------+--------------+--------+ | 6dba2636-44e9-47ce-928c-c9487f76c021 | Trove-Ubuntu | active | | 2216b5ad-eeb5-4b9a-b862-60b84fdfee1c | Ubuntu2204 | active | +--------------------------------------+--------------+--------+[root@dlp ~(keystone)]# openstack volume type create lvm-trove --private +-------------+--------------------------------------+ | Field | Value | +-------------+--------------------------------------+ | description | None | | id | e494c72c-3c1e-418d-8810-679c9f5f1377 | | is_public | False | | name | lvm-trove | +-------------+--------------------------------------+ |
[2] | वह डेटास्टोर जोड़ें जिसका उपयोग आप उस नोड पर करना चाहते हैं जो Trove API चल रहा है। (यह इस उदाहरण पर नेटवर्क नोड है) उदाहरण के लिए, यहां MariaDB, PostgreSQL जोड़ें। |
# डेटास्टोर जोड़ें root@network:~# su -s /bin/bash trove -c "trove-manage datastore_update mariadb ''" Datastore 'mariadb' updated. root@network:~# su -s /bin/bash trove -c "trove-manage datastore_update postgresql ''" Datastore 'postgresql' updated. # प्रत्येक डेटास्टोर के लिए संस्करण जोड़ें # 6dba2636-***] के लिए, यह Trove की छवि आईडी है जिसे आपने [2] में बनाया है root@network:~# su -s /bin/sh -c "trove-manage datastore_version_update mariadb 10.6 mariadb 6dba2636-44e9-47ce-928c-c9487f76c021 mariadb 1" trove Datastore version '10.6(10.6)' updated. root@network:~# su -s /bin/sh -c "trove-manage datastore_version_update postgresql 12 postgresql 6dba2636-44e9-47ce-928c-c9487f76c021 postgresql 1" trove Datastore version '12(12)' updated. # डेटास्टोर के प्रत्येक संस्करण के लिए पैरामीटर जोड़ें root@network:~# su -s /bin/bash trove -c "trove-manage db_load_datastore_config_parameters mariadb 10.6 /usr/lib/python3/dist-packages/trove/templates/mariadb/validation-rules.json" Loading config parameters for datastore (mariadb) version (10.6) root@network:~# su -s /bin/bash trove -c "trove-manage db_load_datastore_config_parameters postgresql 12 /usr/lib/python3/dist-packages/trove/templates/postgresql/validation-rules.json" Loading config parameters for datastore (postgresql) version (12) # VM छवि के लिए [cloudinit] फ़ाइलें बनाएं root@network:~# mkdir /etc/trove/cloudinit
root@network:~#
vi /etc/trove/cloudinit/mariadb.cloudinit # नया निर्माण # [CONTROLLER] के लिए Trove API होस्ट निर्दिष्ट करें #cloud-config runcmd: - echo 'CONTROLLER=network.srv.world' > /etc/trove/controller.conf - chmod 644 /etc/trove/controller.conf cp /etc/trove/cloudinit/mariadb.cloudinit /etc/trove/cloudinit/postgresql.cloudinit root@network:~# chown -R trove /etc/trove/cloudinit |
[3] | किसी भी Openstack उपयोगकर्ता के रूप में लॉगिन करें और नोड पर एक डेटाबेस इंस्टेंस बनाएं। वैसे, डेटाबेस इंस्टेंस VM इंस्टेंस के अंदर डॉकर कंटेनर के रूप में चलता है। |
ubuntu@dlp ~(keystone)$ openstack datastore list +--------------------------------------+------------+ | ID | Name | +--------------------------------------+------------+ | 6590920f-a855-460c-a6f8-e8ae2445f05a | postgresql | | 7f456699-5cf6-4148-9838-a4af886fd7d6 | mariadb | +--------------------------------------+------------+ubuntu@dlp ~(keystone)$ openstack datastore version list mariadb +--------------------------------------+------+---------+ | ID | Name | Version | +--------------------------------------+------+---------+ | ddeedbe7-3643-46c7-8835-931c26af40ab | 10.6 | 10.6 | +--------------------------------------+------+---------+ubuntu@dlp ~(keystone)$ openstack flavor list +----+-----------+------+------+-----------+-------+-----------+ | ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public | +----+-----------+------+------+-----------+-------+-----------+ | 1 | m1.small | 2048 | 10 | 0 | 1 | True | | 2 | m1.medium | 4096 | 10 | 0 | 2 | True | | 3 | m1.large | 8192 | 10 | 0 | 4 | True | | 4 | m2.large | 8192 | 20 | 0 | 4 | True | +----+-----------+------+------+-----------+-------+-----------+ubuntu@dlp ~(keystone)$ openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | 1d42f5e1-1ff2-4f70-8c48-8c7f6eae0672 | public | c192082c-f107-4eed-aafc-6e30b604e283 | | 529ae54a-4bba-40a3-905d-2ca57557236a | private | e14c5e7d-41d0-4378-af0f-0993c4389593 | +--------------------------------------+---------+--------------------------------------+ # डेटाबेस उदाहरण बनाएँ ubuntu@dlp ~(keystone)$ openstack database instance create MariaDB-106 \ --flavor 2 \ --size 10 \ --nic net-id=529ae54a-4bba-40a3-905d-2ca57557236a \ --databases MyDB --users serverworld:password \ --datastore mariadb --datastore-version 10.6 \ --is-public \ --allowed-cidr 10.0.0.0/24 \ --allowed-cidr 192.168.100.0/24 +--------------------------+--------------------------------------+ | Field | Value | +--------------------------+--------------------------------------+ | allowed_cidrs | ['10.0.0.0/24', '192.168.100.0/24'] | | created | 2023-10-10T03:20:57 | | datastore | mariadb | | datastore_version | 10.6 | | datastore_version_number | 10.6 | | flavor | 2 | | id | b394c76b-e3fd-45fe-8aa5-24a07f9ae20e | | name | MariaDB-106 | | operating_status | | | public | True | | region | RegionOne | | service_status_updated | 2023-10-10T03:20:57 | | status | BUILD | | updated | 2023-10-10T03:20:57 | | volume | 10 | +--------------------------+--------------------------------------+ # [BUILD] निर्माण के दौरान स्थिति ubuntu@dlp ~(keystone)$ openstack database instance list +--------------------------------------+-------------+-----------+-------------------+--------+------------------+--------+-----------+-----------+------+------+ | ID | Name | Datastore | Datastore Version | Status | Operating Status | Public | Addresses | Flavor ID | Size | Role | +--------------------------------------+-------------+-----------+-------------------+--------+------------------+--------+-----------+-----------+------+------+ | b394c76b-e3fd-45fe-8aa5-24a07f9ae20e | MariaDB-106 | mariadb | 10.6 | BUILD | | True | | 2 | 10 | | +--------------------------------------+-------------+-----------+-------------------+--------+------------------+--------+-----------+-----------+------+------+ # यदि सफलतापूर्वक बनाया गया है, तो स्थिति [HEALTHY] में बदल जाती है ubuntu@dlp ~(keystone)$ openstack database instance list +--------------------------------------+-------------+-----------+-------------------+--------+------------------+-------- | ID | Name | Datastore | Datastore Version | Status | Operating Status | Public +--------------------------------------+-------------+-----------+-------------------+--------+------------------+-------- | b394c76b-e3fd-45fe-8aa5-24a07f9ae20e | MariaDB-106 | mariadb | 10.6 | ACTIVE | HEALTHY | True +--------------------------------------+-------------+-----------+-------------------+--------+------------------+-------- +-------------------------------------------------------------------------------------------------------- | Addresses +-------------------------------------------------------------------------------------------------------- | [{'address': '192.168.100.156', 'type': 'private', 'network': '529ae54a-4bba-40a3-905d-2ca57557236a'}, +-------------------------------------------------------------------------------------------------------- ---------------------------------------------+-----------+------+------+ | Flavor ID | Size | Role | ---------------------------------------------+-----------+------+------+ {'address': '10.0.0.244', 'type': 'public'}] | 2 | 10 | | ---------------------------------------------+-----------+------+------+ # पहुंच सत्यापित करें ubuntu@dlp ~(keystone)$ mysql -h 10.0.0.246 -u serverworld -p -e "show variables like 'hostname'; show databases;" Enter password: +---------------+--------------+ | Variable_name | Value | +---------------+--------------+ | hostname | 735d226e7528 | +---------------+--------------+ +--------------------+ | Database | +--------------------+ | MyDB | | information_schema | +--------------------+ # किसी डेटाबेस इंस्टेंस को हटाने के लिए, निम्न कार्य करें ubuntu@dlp ~(keystone)$ openstack database instance delete MariaDB-106 Request to delete database instance b394c76b-e3fd-45fe-8aa5-24a07f9ae20e has been accepted. |
[4] | यह PostgreSQL इंस्टेंस बनाने के मामले के लिए है। |
ubuntu@dlp ~(keystone)$ openstack datastore list +--------------------------------------+------------+ | ID | Name | +--------------------------------------+------------+ | 6590920f-a855-460c-a6f8-e8ae2445f05a | postgresql | | 7f456699-5cf6-4148-9838-a4af886fd7d6 | mariadb | +--------------------------------------+------------+ubuntu@dlp ~(keystone)$ openstack datastore version list postgresql
+--------------------------------------+------+---------+
| ID | Name | Version |
+--------------------------------------+------+---------+
| fa031ab9-b596-41cc-8c4c-70ae03f6df51 | 12 | 12 |
+--------------------------------------+------+---------+
ubuntu@dlp ~(keystone)$ openstack database instance create PostgreSQL-12 \
--flavor 2 \
--size 10 \
--nic net-id=529ae54a-4bba-40a3-905d-2ca57557236a \
--databases MyDB --users serverworld:password \
--datastore postgresql --datastore-version 12 \
--datastore-version-number 12 --is-public \
--allowed-cidr 10.0.0.0/24 \
--allowed-cidr 192.168.100.0/24
ubuntu@dlp ~(keystone)$ openstack database instance list +--------------------------------------+---------------+------------+-------------------+--------+------------------+-------- | ID | Name | Datastore | Datastore Version | Status | Operating Status | Public +--------------------------------------+---------------+------------+-------------------+--------+------------------+-------- | a5da69bb-0eb8-4277-9469-f4e309daffc5 | PostgreSQL-12 | postgresql | 12 | ACTIVE | HEALTHY | True +--------------------------------------+---------------+------------+-------------------+--------+------------------+-------- +-------------------------------------------------------------------------------------------------------- | Addresses +-------------------------------------------------------------------------------------------------------- | [{'address': '192.168.100.171', 'type': 'private', 'network': '529ae54a-4bba-40a3-905d-2ca57557236a'}, +-------------------------------------------------------------------------------------------------------- ---------------------------------------------+-----------+------+------+ | Flavor ID | Size | Role | ---------------------------------------------+-----------+------+------+ {'address': '10.0.0.210', 'type': 'public'}] | 2 | 10 | | ---------------------------------------------+-----------+------+------+ubuntu@dlp ~(keystone)$ psql -h 10.0.0.210 -d MyDB -U serverworld -c "SELECT version();" Password for user serverworld: version ----------------------------------------------------------------------------------------------------------------------- PostgreSQL 12.16 (Debian 12.16-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit (1 row) |
Sponsored Link |