Browse Source

Improve guest image creation in devstack

Change-Id: I0ef8cbc4babc5c6b9f2936923ffe2837ecc3da74
changes/91/680391/3
Lingxian Kong 2 weeks ago
parent
commit
3c09e6178a

+ 54
- 176
devstack/plugin.sh View File

@@ -75,9 +75,8 @@ function create_trove_accounts {
75 75
     fi
76 76
 }
77 77
 
78
-# _cleanup_trove_apache_wsgi - Removes all the WSGI related files and
79
-# restart apache.
80
-function _cleanup_trove_apache_wsgi {
78
+# Removes all the WSGI related files and restart apache.
79
+function cleanup_trove_apache_wsgi {
81 80
     sudo rm -rf $TROVE_WSGI_DIR
82 81
     sudo rm -f $(apache_site_config_for trove-api)
83 82
     restart_apache_server
@@ -98,7 +97,7 @@ function cleanup_trove {
98 97
 
99 98
     if [[ "${TROVE_USE_MOD_WSGI}" == "TRUE" ]]; then
100 99
         echo "Cleaning up Trove's WSGI setup"
101
-        _cleanup_trove_apache_wsgi
100
+        cleanup_trove_apache_wsgi
102 101
     fi
103 102
 }
104 103
 
@@ -165,9 +164,8 @@ function configure_nova_kvm {
165 164
     echo "configure_nova_kvm: using virt_type: ${virt_type} for cpu: ${cpu}."
166 165
 }
167 166
 
168
-# _config_trove_apache_wsgi() - Setup WSGI config files for Trove and
169
-# enable the site
170
-function _config_trove_apache_wsgi {
167
+# Setup WSGI config files for Trove and enable the site
168
+function config_trove_apache_wsgi {
171 169
     local trove_apache_conf
172 170
 
173 171
     sudo mkdir -p ${TROVE_WSGI_DIR}
@@ -258,7 +256,7 @@ function configure_trove {
258 256
     # configure apache related files
259 257
     if [[ "${TROVE_USE_MOD_WSGI}" == "TRUE" ]]; then
260 258
         echo "Configuring Trove to use mod-wsgi and Apache"
261
-        _config_trove_apache_wsgi
259
+        config_trove_apache_wsgi
262 260
     fi
263 261
 
264 262
     # Use these values only if they're set
@@ -317,54 +315,12 @@ function install_python_troveclient {
317 315
     fi
318 316
 }
319 317
 
320
-# init_trove() - Initializes Trove Database as a Service
321
-function init_trove {
318
+function init_trove_db {
322 319
     # (Re)Create trove db
323 320
     recreate_database trove
324 321
 
325 322
     # Initialize the trove database
326 323
     $TROVE_MANAGE db_sync
327
-
328
-    # build and upload sample Trove mysql instance if not set otherwise.
329
-    # We recommend to use trovestack tooling for image build.
330
-    TROVE_DISABLE_IMAGE_SETUP=`echo ${TROVE_DISABLE_IMAGE_SETUP,,}`
331
-    if [[ ${TROVE_DISABLE_IMAGE_SETUP} != "true" ]]; then
332
-        echo "Setup datastore image."
333
-        _setup_minimal_image
334
-    else
335
-        echo "Skip datastore image building."
336
-    fi
337
-    [ -z "$TROVE_GUEST_IMAGE_URL" ] && return 0
338
-
339
-    # Find the glance id for the trove guest image
340
-    # The image is uploaded by stack.sh -- see $IMAGE_URLS handling
341
-    GUEST_IMAGE_NAME=$(basename "$TROVE_GUEST_IMAGE_URL")
342
-    GUEST_IMAGE_NAME=${GUEST_IMAGE_NAME%.*}
343
-
344
-    TOKEN=$(openstack token issue -c id -f value)
345
-    TROVE_GUEST_IMAGE_ID=$(openstack --os-token $TOKEN --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT image list | grep "${GUEST_IMAGE_NAME}" | get_field 1)
346
-    if [ -z "$TROVE_GUEST_IMAGE_ID" ]; then
347
-        # If no glance id is found, skip remaining setup
348
-        echo "Datastore ${TROVE_DATASTORE_TYPE} will not be created: guest image ${GUEST_IMAGE_NAME} not found."
349
-        return 1
350
-    fi
351
-
352
-    # Now that we have the guest image id, initialize appropriate datastores / datastore versions
353
-    $TROVE_MANAGE datastore_update "$TROVE_DATASTORE_TYPE" ""
354
-    $TROVE_MANAGE datastore_version_update "$TROVE_DATASTORE_TYPE" "$TROVE_DATASTORE_VERSION" "$TROVE_DATASTORE_TYPE" \
355
-        "$TROVE_GUEST_IMAGE_ID" "$TROVE_DATASTORE_PACKAGE" 1
356
-    $TROVE_MANAGE datastore_version_update "$TROVE_DATASTORE_TYPE" "inactive_version" "inactive_manager" "$TROVE_GUEST_IMAGE_ID" "" 0
357
-    $TROVE_MANAGE datastore_update "$TROVE_DATASTORE_TYPE" "$TROVE_DATASTORE_VERSION"
358
-    $TROVE_MANAGE datastore_update "Inactive_Datastore" ""
359
-
360
-    # Some datastores provide validation rules.
361
-    # if one is provided, configure it.
362
-    if [ -f "${TROVE_DIR}/trove/templates/${TROVE_DATASTORE_TYPE}"/validation-rules.json ]; then
363
-        echo "Configuring validation rules for ${TROVE_DATASTORE_TYPE}"
364
-        $TROVE_MANAGE db_load_datastore_config_parameters \
365
-            "$TROVE_DATASTORE_TYPE" "$TROVE_DATASTORE_VERSION" \
366
-            "${TROVE_DIR}/trove/templates/${TROVE_DATASTORE_TYPE}"/validation-rules.json
367
-    fi
368 324
 }
369 325
 
370 326
 function create_mgmt_subnet_v4 {
@@ -380,7 +336,7 @@ function create_mgmt_subnet_v4 {
380 336
 
381 337
 # Create private IPv6 subnet
382 338
 # Note: Trove is not fully tested in IPv6.
383
-function _create_subnet_v6 {
339
+function create_subnet_v6 {
384 340
     local project_id=$1
385 341
     local net_id=$2
386 342
     local name=$3
@@ -426,13 +382,13 @@ function setup_mgmt_network() {
426 382
     fi
427 383
     # Trove doesn't support IPv6 for now.
428 384
 #    if [[ "$IP_VERSION" =~ .*6 ]]; then
429
-#        NEW_IPV6_SUBNET_ID=$(_create_subnet_v6 ${PROJECT_ID} ${network_id} ${IPV6_SUBNET_NAME})
385
+#        NEW_IPV6_SUBNET_ID=$(create_subnet_v6 ${PROJECT_ID} ${network_id} ${IPV6_SUBNET_NAME})
430 386
 #        openstack router add subnet $ROUTER_ID $NEW_IPV6_SUBNET_ID
431 387
 #    fi
432 388
 }
433 389
 
434 390
 # Set up Trove management network and make configuration change.
435
-function finalize_trove_network {
391
+function config_trove_network {
436 392
     echo "Finalizing Neutron networking for Trove"
437 393
     echo "Dumping current network parameters:"
438 394
     echo "  SERVICE_HOST: $SERVICE_HOST"
@@ -531,117 +487,38 @@ function configure_tempest_for_trove {
531 487
     fi
532 488
 }
533 489
 
534
-# _setup_minimal_image() - build and register in Trove a vm image with mysql
535
-#                        - datastore can be set via env variables
536
-# (lxkong): This function is deprecated in favor of trovestack script.
537
-function _setup_minimal_image {
538
-    ##### Prerequisites:
539
-    ##### - SSH KEYS has to be created on controller
540
-    ##### - trove will access controller ip to get trove source code by using HOST_SCP_USERNAME and an ssh key
541
-    ##### - we assume tripleo elements and all other elements have been downloaded
542
-
543
-    echo "Exporting image-related environmental variables"
544
-    PRIMARY_IP=$(ip route get 8.8.8.8 | head -1 | awk '{print $7}')
545
-    export CONTROLLER_IP=${CONTROLLER_IP:-$PRIMARY_IP}
546
-    export HOST_USERNAME=${HOST_USERNAME:-'stack'}
547
-    export HOST_SCP_USERNAME=${HOST_SCP_USERNAME:-'stack'}
548
-    export GUEST_USERNAME=${GUEST_USERNAME:-'ubuntu'}
549
-    export PATH_TROVE=${PATH_TROVE:-'/opt/stack/trove'}
550
-    export ESCAPED_PATH_TROVE=$(echo $PATH_TROVE | sed 's/\//\\\//g')
551
-    export TROVESTACK_SCRIPTS=${TROVESTACK_SCRIPTS:-'/opt/stack/trove/integration/scripts'}
552
-    export TROVE_DATASTORE_TYPE=${TROVE_DATASTORE_TYPE:-'mysql'}
553
-    export TROVE_DATASTORE_VERSION=${TROVE_DATASTORE_VERSION:-'5.7'}
554
-    export TROVE_DATASTORE_PACKAGE=${TROVE_DATASTORE_PACKAGE:-"${TROVE_DATASTORE_TYPE}-${TROVE_DATASTORE_VERSION}"}
555
-    export SSH_DIR=${SSH_DIR:-'/opt/stack/.ssh'}
556
-    export GUEST_LOGDIR=${GUEST_LOGDIR:-'/var/log/trove/'}
557
-    export ESCAPED_GUEST_LOGDIR=$(echo $GUEST_LOGDIR | sed 's/\//\\\//g')
558
-    export DIB_CLOUD_INIT_DATASOURCES="ConfigDrive"
559
-    export DISTRO="ubuntu"
560
-    export VM=${VM:-"/opt/stack/images/${DISTRO}_${TROVE_DATASTORE_TYPE}/${DISTRO}_${TROVE_DATASTORE_TYPE}"}
561
-
562
-    if [ -d "$TROVESTACK_SCRIPTS/files/elements" ]; then
563
-        export ELEMENTS_PATH=$TROVESTACK_SCRIPTS/files/elements
564
-    else
565
-        export ELEMENTS_PATH=.
566
-    fi
567
-
568
-    if [ ! -z "$PATH_DISKIMAGEBUILDER" ]; then
569
-        export ELEMENTS_PATH+=:$PATH_DISKIMAGEBUILDER/elements
570
-    elif [ -d "/usr/local/lib/python2.7/dist-packages/diskimage_builder" ]; then
571
-        PATH_DISKIMG="/usr/local/lib/python2.7/dist-packages/diskimage_builder"
572
-        export ELEMENTS_PATH+=:$PATH_DISKIMG/elements
573
-    fi
574
-
575
-    if [ ! -z "$PATH_TRIPLEO_ELEMENTS" ]; then
576
-        export ELEMENTS_PATH+=:$PATH_TRIPLEO_ELEMENTS/elements
577
-    else
578
-        git_clone $TRIPLEO_IMAGES_REPO $TRIPLEO_IMAGES_DIR $TRIPLEO_IMAGES_BRANCH
579
-        setup_develop $TRIPLEO_IMAGES_DIR
580
-
581
-        export ELEMENTS_PATH+=:$TRIPLEO_IMAGES_DIR/elements
582
-    fi
583
-
584
-    export QEMU_IMG_OPTIONS="--qemu-img-options compat=1.1"
585
-    export RELEASE=${RELEASE:-'xenial'}
586
-    export DIB_APT_CONF_DIR=/etc/apt/apt.conf.d
587
-    export DIB_CLOUD_INIT_ETC_HOSTS=true
588
-    export DIB_RELEASE=${RELEASE:-'xenial'}
589
-
590
-    # https://cloud-images.ubuntu.com/releases is more stable than the daily
591
-    # builds(https://cloud-images.ubuntu.com/xenial/current/),
592
-    # e.g. sometimes SHA256SUMS file is missing in the daily builds
593
-    declare -A releasemapping=( ["xenial"]="16.04" ["bionic"]="18.04")
594
-    export DIB_CLOUD_IMAGES="https://cloud-images.ubuntu.com/releases/${DIB_RELEASE}/release/"
595
-    export BASE_IMAGE_FILE="ubuntu-${releasemapping[${DIB_RELEASE}]}-server-cloudimg-amd64-root.tar.gz"
596
-
597
-    export TROVE_GUESTAGENT_CONF=${TROVE_GUESTAGENT_CONF:-'/etc/trove/trove-guestagent.conf'}
598
-
599
-    if [[ -d ${SSH_DIR} && -f ${SSH_DIR}/id_rsa.pub ]]; then
600
-        cat ${SSH_DIR}/id_rsa.pub >> ${SSH_DIR}/authorized_keys
601
-        sort ${SSH_DIR}/authorized_keys | uniq > ${SSH_DIR}/authorized_keys.uniq
602
-        mv ${SSH_DIR}/authorized_keys.uniq ${SSH_DIR}/authorized_keys
603
-    else
604
-        mkdir -p ${SSH_DIR}
605
-        /usr/bin/ssh-keygen -f ${SSH_DIR}/id_rsa -q -N ""
606
-        cat ${SSH_DIR}/id_rsa.pub >> ${SSH_DIR}/authorized_keys
607
-        chmod 600 ${SSH_DIR}/authorized_keys
490
+# Use trovestack to create guest image and register the image in the datastore.
491
+function create_guest_image {
492
+    TROVE_DISABLE_IMAGE_SETUP=`echo ${TROVE_DISABLE_IMAGE_SETUP,,}`
493
+    if [[ ${TROVE_DISABLE_IMAGE_SETUP} == "true" ]]; then
494
+        echo "Skip creating guest image."
495
+        return 0
608 496
     fi
609 497
 
610
-    # Make sure the guest agent has permission to ssh into the devstack host
611
-    # in order to download trove code during the service initialization.
612
-    home_keys=$HOME/.ssh/authorized_keys
613
-    cat ${SSH_DIR}/id_rsa.pub >> ${home_keys}
614
-    sort ${home_keys} | uniq > ${home_keys}.uniq
615
-    mv ${home_keys}.uniq ${home_keys}
498
+    echo "Starting to create guest image..."
616 499
 
617
-    echo "Run disk image create to actually create a new image"
618
-    disk-image-create -a amd64 -o "${VM}" -x ${QEMU_IMG_OPTIONS} ${DISTRO} \
619
-        vm cloud-init-datasources ${DISTRO}-guest ${DISTRO}-${RELEASE}-guest \
620
-        ${DISTRO}-${TROVE_DATASTORE_TYPE} ${DISTRO}-${RELEASE}-${TROVE_DATASTORE_TYPE}
500
+    $DEST/trove/integration/scripts/trovestack build-image ${TROVE_DATASTORE_TYPE} ${TROVE_IMAGE_OS} ${TROVE_IMAGE_OS_RELEASE} true
621 501
 
622
-    QCOW_IMAGE="$VM.qcow2"
623
-
624
-    if [ ! -f $QCOW_IMAGE ]; then
625
-        echo "Image file was not found at $QCOW_IMAGE. Probably it was not created."
502
+    image_name=${TROVE_IMAGE_OS}-${TROVE_DATASTORE_TYPE}
503
+    image_file=$HOME/images/${image_name}.qcow2
504
+    if [ ! -f ${image_file} ]; then
505
+        echo "Image file was not found at ${image_file}. Probably it was not created."
626 506
         return 1
627 507
     fi
628 508
 
629 509
     ACTIVE=1
630 510
     INACTIVE=0
631 511
 
632
-    echo "Add image to glance"
633
-    GLANCE_OUT=$(openstack --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT \
634
-        image create $DISTRO-${TROVE_DATASTORE_TYPE}-${TROVE_DATASTORE_VERSION} \
635
-        --public --disk-format qcow2 --container-format bare --file $QCOW_IMAGE)
636
-    glance_image_id=$(echo "$GLANCE_OUT" | grep '| id ' | awk '{print $4}')
512
+    echo "Add the image to glance"
513
+    glance_image_id=$(openstack --os-region-name RegionOne --os-password ${SERVICE_PASSWORD} \
514
+      --os-project-name service --os-username trove \
515
+      image create ${TROVE_IMAGE_OS}-${TROVE_IMAGE_OS_RELEASE}-${TROVE_DATASTORE_TYPE} \
516
+      --disk-format qcow2 --container-format bare --property hw_rng_model='virtio' --file ${image_file} \
517
+      -c id -f value)
637 518
 
638
-    echo "Create datastore specific entry in Trove AFAIK one per datastore, do not need when changing image"
519
+    echo "Register the image in datastore"
639 520
     $TROVE_MANAGE datastore_update $TROVE_DATASTORE_TYPE ""
640
-
641
-    echo "Connect datastore entry to glance image"
642 521
     $TROVE_MANAGE datastore_version_update $TROVE_DATASTORE_TYPE $TROVE_DATASTORE_VERSION $TROVE_DATASTORE_TYPE $glance_image_id "" $ACTIVE
643
-
644
-    echo "Set default datastore version"
645 522
     $TROVE_MANAGE datastore_update $TROVE_DATASTORE_TYPE $TROVE_DATASTORE_VERSION
646 523
 
647 524
     # just for tests
@@ -649,24 +526,22 @@ function _setup_minimal_image {
649 526
     $TROVE_MANAGE datastore_update Test_Datastore_1 ""
650 527
 
651 528
     echo "Add validation rules if available"
652
-    if [ -f "$PATH_TROVE"/trove/templates/$TROVE_DATASTORE_TYPE/validation-rules.json ]; then
529
+    if [ -f $DEST/trove/trove/templates/$TROVE_DATASTORE_TYPE/validation-rules.json ]; then
653 530
         $TROVE_MANAGE db_load_datastore_config_parameters "$TROVE_DATASTORE_TYPE" "$TROVE_DATASTORE_VERSION" \
654
-            "$PATH_TROVE"/trove/templates/$TROVE_DATASTORE_TYPE/validation-rules.json
531
+            $DEST/trove/trove/templates/$TROVE_DATASTORE_TYPE/validation-rules.json
655 532
     fi
656 533
 
657
-    echo "Generate cloudinit"
658
-    CLOUDINIT_PATH=/etc/trove/cloudinit/mysql.cloudinit
659
-
660
-    if [ ! -f $CLOUDINIT_PATH ]; then
661
-        sudo mkdir -p $(dirname $CLOUDINIT_PATH)
662
-
663
-        sudo echo "#!/usr/bin/env bash" | sudo tee $CLOUDINIT_PATH
664
-        PUBKEY=`cat ${SSH_DIR}/id_rsa.pub`
665
-        sudo echo "echo '${PUBKEY}' > /home/${GUEST_USERNAME}/.ssh/authorized_keys" | sudo tee --append $CLOUDINIT_PATH
666
-    fi
534
+    # To avoid 'Connection timed out' error of sudo command inside the guest agent.
535
+    CLOUDINIT_PATH=/etc/trove/cloudinit/${TROVE_DATASTORE_TYPE}.cloudinit
536
+    sudo mkdir -p $(dirname "$CLOUDINIT_PATH")
537
+    sudo touch "$CLOUDINIT_PATH"
538
+    sudo tee $CLOUDINIT_PATH >/dev/null <<'EOF'
539
+#cloud-config
540
+manage_etc_hosts: "localhost"
541
+EOF
667 542
 }
668 543
 
669
-function _config_nova_keypair {
544
+function config_nova_keypair {
670 545
     export SSH_DIR=${SSH_DIR:-"$HOME/.ssh"}
671 546
 
672 547
     if [[ ! -f ${SSH_DIR}/id_rsa.pub ]]; then
@@ -689,7 +564,14 @@ function _config_nova_keypair {
689 564
     iniset $TROVE_CONF DEFAULT nova_keypair ${TROVE_MGMT_KEYPAIR_NAME}
690 565
 }
691 566
 
692
-function _config_mgmt_security_group {
567
+function config_cinder_volume_type {
568
+    volume_type=$(openstack --os-region-name RegionOne --os-password ${SERVICE_PASSWORD} \
569
+      --os-project-name service --os-username trove \
570
+      volume type list -c Name -f value | awk 'NR==1 {print}')
571
+
572
+    iniset $TROVE_CONF DEFAULT cinder_volume_type ${volume_type}
573
+}
574
+function config_mgmt_security_group {
693 575
     local sgid
694 576
 
695 577
     echo "Creating Trove management security group."
@@ -719,17 +601,13 @@ if is_service_enabled trove; then
719 601
         echo_summary "Configuring Trove"
720 602
         configure_trove
721 603
     elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
722
-        # Initialize trove
723
-        init_trove
724
-
725
-        _config_nova_keypair
726
-        _config_mgmt_security_group
727
-
728
-        # finish the last step in trove network configuration
729
-        echo_summary "Finalizing Trove Network Configuration"
730
-        finalize_trove_network
604
+        init_trove_db
605
+        config_nova_keypair
606
+        config_cinder_volume_type
607
+        config_mgmt_security_group
608
+        config_trove_network
609
+        create_guest_image
731 610
 
732
-        # Start the trove API and trove taskmgr components
733 611
         echo_summary "Starting Trove"
734 612
         start_trove
735 613
 

+ 2
- 0
devstack/settings View File

@@ -28,6 +28,8 @@ TROVE_LOCAL_CONF_DIR=${TROVE_LOCAL_CONF_DIR:-${TROVE_DIR}/etc/trove}
28 28
 TROVE_LOCAL_API_PASTE_INI=${TROVE_LOCAL_API_PASTE_INI:-${TROVE_LOCAL_CONF_DIR}/api-paste.ini}
29 29
 TROVE_LOCAL_POLICY_JSON=${TROVE_LOCAL_POLICY_JSON:-${TROVE_LOCAL_CONF_DIR}/policy.json}
30 30
 
31
+TROVE_IMAGE_OS=${TROVE_IMAGE_OS:-"ubuntu"}
32
+TROVE_IMAGE_OS_RELEASE=${TROVE_IMAGE_OS_RELEASE:-"xenial"}
31 33
 TROVE_DATASTORE_TYPE=${TROVE_DATASTORE_TYPE:-"mysql"}
32 34
 if [[ "$DISTRO" == "xenial" || "$DISTRO" == "bionic" ]]; then
33 35
     TROVE_DATASTORE_VERSION=${TROVE_DATASTORE_VERSION:-"5.7"}

+ 6
- 9
doc/source/install/index.rst View File

@@ -2,22 +2,19 @@
2 2
 Database service
3 3
 ================
4 4
 
5
+The Database service (Trove) provides scalable and reliable Cloud Database as a
6
+Service provisioning functionality for both relational and non-relational
7
+database engines.
8
+
5 9
 .. toctree::
6 10
 
7 11
    apache-mod-wsgi.rst
8 12
    get_started.rst
9
-   install.rst
13
+   install-devstack.rst
14
+   install-manual.rst
10 15
    install-obs.rst
11 16
    install-rdo.rst
12 17
    install-ubuntu.rst
13
-   manual_install.rst
14 18
    dashboard.rst
15 19
    verify.rst
16 20
    next-steps.rst
17
-
18
-
19
-The Database service (trove) provides cloud provisioning functionality
20
-for database engines.
21
-
22
-This chapter assumes a working setup of OpenStack following the
23
-`OpenStack Installation Tutorial <http://docs.openstack.org/#install-guides>`_.

+ 186
- 0
doc/source/install/install-devstack.rst View File

@@ -0,0 +1,186 @@
1
+..
2
+      Copyright 2019 Catalyst Cloud
3
+      All Rights Reserved.
4
+      not use this file except in compliance with the License. You may obtain
5
+      a copy of the License at
6
+
7
+          http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+      Unless required by applicable law or agreed to in writing, software
10
+      distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+      WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+      License for the specific language governing permissions and limitations
13
+      under the License.
14
+
15
+Install Trove in DevStack
16
+=========================
17
+
18
+This page describes how to set up a working development
19
+environment that can be used in deploying Trove on latest releases
20
+of Ubuntu.
21
+
22
+Following these instructions will allow you to have a fully functional Trove
23
+environment using the DevStack on Ubuntu 16.04 or 18.04.
24
+
25
+Config DevStack with Trove
26
+~~~~~~~~~~~~~~~~~~~~~~~~~~
27
+
28
+Trove can be enabled in devstack by using the plug-in based interface it
29
+offers.
30
+
31
+.. note::
32
+
33
+   The following steps have been fully verified both on Ubuntu 16.04 and 18.04.
34
+
35
+Start by cloning the devstack repository using a non-root user(the default user
36
+is ``ubuntu``) and change to devstack directory:
37
+
38
+.. code-block:: console
39
+
40
+    git clone https://opendev.org/openstack/devstack
41
+    cd devstack/
42
+
43
+Create the ``local.conf`` file with the following minimal devstack
44
+configuration, change the ``HOST_IP`` to your own devstack host IP address:
45
+
46
+.. code-block:: ini
47
+
48
+    [[local|localrc]]
49
+    RECLONE=False
50
+    HOST_IP=<your-host-ip-here>
51
+
52
+    enable_plugin trove https:/opendev.org/openstack/trove
53
+
54
+    LIBS_FROM_GIT+=,python-troveclient
55
+    DATABASE_PASSWORD=password
56
+    ADMIN_PASSWORD=password
57
+    SERVICE_PASSWORD=password
58
+    SERVICE_TOKEN=password
59
+    RABBIT_PASSWORD=password
60
+    LOGFILE=$DEST/logs/stack.sh.log
61
+    VERBOSE=True
62
+    LOG_COLOR=False
63
+    LOGDAYS=1
64
+
65
+    IPV4_ADDRS_SAFE_TO_USE=10.111.0.0/26
66
+    FIXED_RANGE=10.111.0.0/26
67
+    NETWORK_GATEWAY=10.111.0.1
68
+    FLOATING_RANGE=172.30.5.0/24
69
+    PUBLIC_NETWORK_GATEWAY=172.30.5.1
70
+
71
+    # Pre-requisites
72
+    ENABLED_SERVICES=rabbit,mysql,key
73
+
74
+    # Nova
75
+    enable_service n-api
76
+    enable_service n-cpu
77
+    enable_service n-cond
78
+    enable_service n-sch
79
+    enable_service n-api-meta
80
+    enable_service placement-api
81
+    enable_service placement-client
82
+
83
+    # Glance
84
+    enable_service g-api
85
+    enable_service g-reg
86
+
87
+    # Cinder
88
+    enable_service cinder
89
+    enable_service c-api
90
+    enable_service c-vol
91
+    enable_service c-sch
92
+
93
+    # Neutron
94
+    enable_service q-svc
95
+    enable_service q-agt
96
+    enable_service q-dhcp
97
+    enable_service q-l3
98
+    enable_service q-meta
99
+
100
+    # enable DVR
101
+    Q_PLUGIN=ml2
102
+    Q_ML2_TENANT_NETWORK_TYPE=vxlan
103
+    Q_DVR_MODE=legacy
104
+
105
+    # Swift
106
+    ENABLED_SERVICES+=,swift
107
+    SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
108
+    SWIFT_REPLICAS=1
109
+
110
+    # Trove
111
+    TROVE_DISABLE_IMAGE_SETUP=False
112
+
113
+Take a look at the
114
+`options <https://opendev.org/openstack/trove/src/branch/master/devstack/settings>`_
115
+you could use to customize the Trove installation.
116
+
117
+Running devstack
118
+~~~~~~~~~~~~~~~~
119
+
120
+Run the ``stack.sh`` script:
121
+
122
+.. code-block:: console
123
+
124
+    ./stack.sh
125
+
126
+After it completes, you can see there is a MySQL datastore available to create
127
+Trove instance:
128
+
129
+.. code-block:: console
130
+
131
+    $ openstack datastore version list mysql
132
+    +--------------------------------------+------------------+
133
+    | ID                                   | Name             |
134
+    +--------------------------------------+------------------+
135
+    | 9726354d-f989-4a68-9c5f-6e37b1bccc74 | 5.7              |
136
+    | f81a8448-2f6e-4746-8d97-866ab7dcccee | inactive_version |
137
+    +--------------------------------------+------------------+
138
+
139
+Create your first Trove instance
140
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
141
+
142
+#.  Switch to a non-admin user, choose a Nova flavor ID for the Trove
143
+    instance.
144
+
145
+    .. code-block:: console
146
+
147
+        $ source ~/devstack/openrc demo demo
148
+        $ openstack flavor list
149
+        +----+---------------+-------+------+-----------+-------+-----------+
150
+        | ID | Name          |   RAM | Disk | Ephemeral | VCPUs | Is Public |
151
+        +----+---------------+-------+------+-----------+-------+-----------+
152
+        | 1  | m1.tiny       |   512 |    1 |         0 |     1 | True      |
153
+        | 2  | m1.small      |  2048 |   20 |         0 |     1 | True      |
154
+        | 3  | m1.medium     |  4096 |   40 |         0 |     2 | True      |
155
+        | 4  | m1.large      |  8192 |   80 |         0 |     4 | True      |
156
+        | 5  | m1.xlarge     | 16384 |  160 |         0 |     8 | True      |
157
+        | 6  | mysql-minimum |   512 |    5 |         0 |     1 | True      |
158
+        | c1 | cirros256     |   256 |    1 |         0 |     1 | True      |
159
+        | d1 | ds512M        |   512 |    5 |         0 |     1 | True      |
160
+        | d2 | ds1G          |  1024 |   10 |         0 |     1 | True      |
161
+        | d3 | ds2G          |  2048 |   10 |         0 |     2 | True      |
162
+        | d4 | ds4G          |  4096 |   20 |         0 |     4 | True      |
163
+        +----+---------------+-------+------+-----------+-------+-----------+
164
+        $ flavorid=6
165
+
166
+#.  Choose a private network on which the database service can be accessed.
167
+
168
+    .. code-block:: console
169
+
170
+        $ openstack network list --internal
171
+        +--------------------------------------+---------+----------------------------------------------------------------------------+
172
+        | ID                                   | Name    | Subnets                                                                    |
173
+        +--------------------------------------+---------+----------------------------------------------------------------------------+
174
+        | a0f3cf12-3562-4064-aa34-61d37265e867 | private | 377e791f-2631-4d8e-93cd-036344b24b3f, 7e04abb4-7c16-4b92-8865-7831ecf3ee66 |
175
+        +--------------------------------------+---------+----------------------------------------------------------------------------+
176
+        # netid=a0f3cf12-3562-4064-aa34-61d37265e867
177
+
178
+#.  Create the Trove instance.
179
+
180
+    .. code-block:: console
181
+
182
+        $ openstack database instance create my-first-trove-instance $flavorid \
183
+          --size 1 \
184
+          --nic net-id=$netid \
185
+          --datastore mysql --datastore_version 5.7 \
186
+          --databases test --users test_user:password

+ 243
- 0
doc/source/install/install-manual.rst View File

@@ -0,0 +1,243 @@
1
+.. _install-manual:
2
+
3
+Manual Trove Installation
4
+=========================
5
+
6
+Objectives
7
+~~~~~~~~~~
8
+
9
+This document provides a step-by-step guide for manual installation of Trove
10
+with an existing OpenStack environment for development purposes.
11
+
12
+This document will not cover OpenStack setup for other services.
13
+
14
+Requirements
15
+~~~~~~~~~~~~
16
+
17
+A running OpenStack environment installed on Ubuntu 16.04 or 18.04 LTS is
18
+required, including the following components:
19
+
20
+- Compute (Nova)
21
+- Image Service (Glance)
22
+- Identity (Keystone)
23
+- Network (Neutron)
24
+- If you want to provision databases on block-storage volumes, you also need
25
+  Block Storage (Cinder)
26
+- If you want to do backup/restore or replication, you also need Object Storage
27
+  (Swift)
28
+- AMQP service (RabbitMQ or QPID)
29
+- MySQL (SQLite, PostgreSQL) database
30
+
31
+Networking requirements
32
+-----------------------
33
+
34
+Trove makes use of an "Management Network" that the controller uses to talk to
35
+trove instance and vice versa. All the trove instance that Trove deploys will
36
+have interfaces and IP addresses on this network. Therefore, it’s important
37
+that the subnet deployed on this network be sufficiently large to allow for the
38
+maximum number of trove instance and controllers likely to be deployed
39
+throughout the lifespan of the cloud installation.
40
+
41
+You must also create a Neutron security group which will be applied to trove
42
+instance port created on the management network. The cloud admin has full
43
+control of the security group, e.g it can be helpful to allow SSH access to the
44
+trove instance from the controller for troubleshooting purposes (ie. TCP port
45
+22), though this is not strictly necessary in production environments.
46
+
47
+Finally, you need to add routing or interfaces to this network so that the
48
+Trove controller is able to communicate with Nova servers on this network.
49
+
50
+Trove Installation
51
+~~~~~~~~~~~~~~~~~~
52
+
53
+Required packages for Trove
54
+---------------------------
55
+
56
+List of packages to be installed:
57
+
58
+.. code-block:: bash
59
+
60
+    $ sudo apt-get install -y build-essential python-dev libpython-dev \
61
+    python-setuptools libffi-dev libxslt1-dev libxml2-dev libyaml-dev \
62
+    libssl-dev zlib1g-dev mysql-client python-pymysql libmysqlclient-dev git
63
+
64
+Python settings
65
+---------------
66
+
67
+Install pip:
68
+
69
+.. code-block:: bash
70
+
71
+    curl -SO# https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py pip==9.0.3 && rm -f get-pip.py
72
+
73
+Install virtualenv, create Trove environment and activate it:
74
+
75
+.. code-block:: bash
76
+
77
+    pip install virtualenv --user
78
+    virtualenv --system-site-packages trove_env
79
+    source trove_env/bin/activate
80
+
81
+Get Trove
82
+---------
83
+
84
+Obtain the Trove source components from OpenStack repositories:
85
+
86
+.. code-block:: bash
87
+
88
+    cd ~
89
+    git clone https://opendev.org/openstack/trove.git
90
+    git clone https://opendev.org/openstack/python-troveclient.git
91
+
92
+
93
+Install Trove
94
+-------------
95
+
96
+First, install the requirements:
97
+
98
+.. code-block:: bash
99
+
100
+    cd ~/trove
101
+    sudo pip install -r requirements.txt -r test-requirements.txt
102
+
103
+Then, install Trove:
104
+
105
+.. code-block:: bash
106
+
107
+    sudo pip install -e .
108
+
109
+Finally, install the Trove client:
110
+
111
+.. code-block:: bash
112
+
113
+    cd ~/python-troveclient
114
+    sudo pip install -e .
115
+    cd ~
116
+
117
+Other required OpenStack clients (python-novaclient, python-keystoneclient,
118
+etc.) should already be installed as part of the Trove requirements.
119
+
120
+Prepare Trove for OpenStack
121
+---------------------------
122
+
123
+.. note::
124
+
125
+    You need to run the following commands using OpenStack admin credentials.
126
+
127
+#.  Create Trove service user with admin role in the ``service`` project.
128
+
129
+    .. code-block:: bash
130
+
131
+        openstack user create trove --project service --password-prompt
132
+        openstack role add --user trove --project service admin
133
+
134
+#.  Register Trove in Keystone.
135
+
136
+    .. code-block:: bash
137
+
138
+        openstack service create --name trove --description "Database" database
139
+        openstack endpoint create --region RegionOne database public 'http://<EnvironmentPublicIP>:8779/v1.0/$(tenant_id)s'
140
+        openstack endpoint create --region RegionOne database admin 'http://<EnvironmentPublicIP>:8779/v1.0/$(tenant_id)s'
141
+        openstack endpoint create --region RegionOne database internal 'http://<EnvironmentPublicIP>:8779/v1.0/$(tenant_id)s'
142
+
143
+    Where <EnvironmentPublicIP> is the IP address of the server where Trove was
144
+    installed. This IP should be reachable from any hosts that will be used to
145
+    communicate with Trove.
146
+
147
+Trove configuration
148
+~~~~~~~~~~~~~~~~~~~
149
+
150
+There are several configuration files for Trove, you can find samples of the
151
+config files in ``etc/trove/`` of Trove repo:
152
+
153
+- api-paste.ini and trove.conf — For trove-api service
154
+- trove-guestagent.conf — For trove-guestagent service
155
+- ``<datastore_manager>.cloudinit`` — Userdata for VMs during provisioning
156
+
157
+Options in trove.conf
158
+---------------------
159
+
160
+#.  Config service tenant model, change the values according to your own
161
+    environment.
162
+
163
+    .. code-block:: ini
164
+
165
+        nova_proxy_admin_user = admin
166
+        nova_proxy_admin_pass = password
167
+        nova_proxy_admin_tenant_name = admin
168
+        nova_proxy_admin_tenant_id = f472127c03f6410899225e26a3c1d22c
169
+        nova_proxy_admin_user_domain_name = default
170
+        nova_proxy_admin_project_domain_name = default
171
+        remote_nova_client = trove.common.single_tenant_remote.nova_client_trove_admin
172
+        remote_cinder_client = trove.common.single_tenant_remote.cinder_client_trove_admin
173
+        remote_neutron_client = trove.common.single_tenant_remote.neutron_client_trove_admin
174
+        os_region_name = RegionOne
175
+
176
+#.  Management config options.
177
+
178
+    management_networks
179
+      Trove management network ID list. Cloud admin needs to create the
180
+      networks.
181
+
182
+    management_security_groups
183
+      Security group IDs that applied to the management port in the trove
184
+      instance. Cloud admin needs to create the security groups.
185
+
186
+    nova_keypair
187
+      The Nova keypair used to create trove instance. Cloud admin needs to
188
+      create the keypair.
189
+
190
+    cinder_volume_type
191
+      The Cinder volume type name used to create volume that attached to the
192
+      trove instance, otherwise, users need to provide the volume type when
193
+      creating the instance.
194
+
195
+Prepare Trove database
196
+~~~~~~~~~~~~~~~~~~~~~~
197
+
198
+Create the Trove database schema:
199
+
200
+- Connect to the storage backend (MySQL, PostgreSQL)
201
+- Create a database called `trove` (this database will be used for storing
202
+  Trove ORM)
203
+- Compose connection string. Example:
204
+  ``mysql+pymysql://<user>:<password>@<backend_host>:<backend_port>/<database_name>``
205
+
206
+Initialize the database
207
+-----------------------
208
+
209
+Once the database for Trove is created, its structure needs to be populated.
210
+
211
+.. code-block:: bash
212
+
213
+    $ trove-manage db_sync
214
+
215
+Create and register Trove guest image
216
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
217
+
218
+To build Trove guest image, refer to
219
+`Build guest agent image <https://docs.openstack.org/trove/latest/admin/trovestack.html#build-guest-agent-image>`_
220
+
221
+Run Trove
222
+~~~~~~~~~
223
+
224
+Starting Trove services
225
+-----------------------
226
+
227
+Run trove-api:
228
+
229
+.. code-block:: bash
230
+
231
+    $ trove-api --config-file=${TROVE_CONF_DIR}/trove.conf &
232
+
233
+Run trove-taskmanager:
234
+
235
+.. code-block:: bash
236
+
237
+    $ trove-taskmanager --config-file=${TROVE_CONF_DIR}/trove.conf &
238
+
239
+Run trove-conductor:
240
+
241
+.. code-block:: bash
242
+
243
+   $ trove-conductor --config-file=${TROVE_CONF_DIR}/trove.conf &

+ 0
- 24
doc/source/install/install.rst View File

@@ -1,24 +0,0 @@
1
-.. _trove-install:
2
-
3
-Install and configure
4
-~~~~~~~~~~~~~~~~~~~~~
5
-
6
-This section describes how to install and configure the
7
-Database service, code-named trove, on the controller node.
8
-
9
-This section assumes that you already have a working OpenStack
10
-environment with at least the following components installed:
11
-Compute, Image Service, Identity.
12
-
13
-* If you want to do backup and restore, you also need Object Storage.
14
-
15
-* If you want to provision datastores on block-storage volumes, you also
16
-  need Block Storage.
17
-
18
-Note that installation and configuration vary by distribution.
19
-
20
-.. toctree::
21
-
22
-   install-obs.rst
23
-   install-rdo.rst
24
-   install-ubuntu.rst

+ 0
- 466
doc/source/install/manual_install.rst View File

@@ -1,466 +0,0 @@
1
-.. _manual_install:
2
-
3
-=========================
4
-Manual Trove Installation
5
-=========================
6
-
7
-Objectives
8
-==========
9
-
10
-This document provides a step-by-step guide for manual installation of Trove with
11
-an existing OpenStack environment for development purposes.
12
-
13
-This document will not cover:
14
-
15
-- OpenStack setup
16
-- Trove service configuration
17
-
18
-Requirements
19
-============
20
-
21
-A running OpenStack environment is required, including the following components:
22
-
23
-- Compute (Nova)
24
-- Image Service (Glance)
25
-- Identity (Keystone)
26
-- Network (Neutron)
27
-- If you want to provision datastores on block-storage volumes, you also will need Block Storage (Cinder)
28
-- If you want to do backup/restore and replication, you will also need Object Storage (Swift)
29
-- An environment with a freshly installed Ubuntu 16.04 LTS to run Trove services.
30
-  This will be referred to as "local environment"
31
-- AMQP service (RabbitMQ or QPID)
32
-- MySQL (SQLite, PostgreSQL) database for Trove's internal needs, accessible from the local environment
33
-- Certain OpenStack services must be accessible from VMs:
34
-    - Swift
35
-
36
-- VMs must be accessible from local environment for development/debugging purposes
37
-
38
-- OpenStack services must be accessible directly from the local environment, such as:
39
-    - Nova
40
-    - Cinder
41
-    - Swift
42
-    - Heat
43
-
44
-Installation
45
-============
46
-
47
------------
48
-Gather info
49
------------
50
-
51
-The following information about the existing environment is required:
52
-
53
-- Keystone host and port(s)
54
-- OpenStack administrator's username, tenant name and password
55
-- Nova URL
56
-- Cinder URL
57
-- Swift URL
58
-- Heat URL
59
-- AMQP connection credentials (server URL, user, password)
60
-- Trove's controller backend connection string (MySQL, SQLite, PostgreSQL)
61
-
62
---------------------
63
-Install dependencies
64
---------------------
65
-
66
-Required packages for Trove
67
----------------------------
68
-
69
-List of packages to be installed:
70
-
71
-.. code-block:: bash
72
-
73
-   $ sudo apt-get install build-essential libxslt1-dev qemu-utils mysql-client \
74
-     git python-dev python-pexpect python-pymysql libmysqlclient-dev
75
-
76
-Python settings
77
----------------
78
-
79
-To find out which setuptools version is latest please check out the `setuptools repo`_.
80
-
81
-.. _setuptools repo: https://pypi.org/project/setuptools/
82
-
83
-To find out which pip version is latest please visit the `pip repo`_.
84
-
85
-.. _pip repo: https://pypi.org/project/pip/
86
-
87
-Some packages in Ubuntu repositories are outdated. Please make sure to update to the latest versions from the appropriate sources.
88
-
89
-Use latest setuptools:
90
-
91
-Go https://pypi.org/project/setuptools, download the latest source setuptools, and move it under ~
92
-
93
-.. code-block:: bash
94
-
95
-    $ cd ~
96
-    $ tar xfvz setuptools-{{latest}}.tar.gz
97
-    $ cd setuptools-{{latest}}
98
-    $ python setup.py install --user
99
-
100
-Use latest pip:
101
-
102
-Go https://pypi.org/project/pip, download the latest source pip, and move it under ~
103
-
104
-.. code-block:: bash
105
-
106
-    $ tar xfvz pip-{{latest}}.tar.gz
107
-    $ cd pip-{{latest}}
108
-    $ python setup.py install --user
109
-
110
-Note '--user' above -- we installed packages in user's home dir, in $HOME/.local/bin, so we need to add it to path:
111
-
112
-.. code-block:: bash
113
-
114
-    $ echo PATH="$HOME/.local/bin:$PATH" >> ~/.profile
115
-    $ . ~/.profile
116
-
117
-Install virtualenv, create environment and activate it:
118
-
119
-.. code-block:: bash
120
-
121
-    $ pip install virtualenv --user
122
-    $ virtualenv --system-site-packages env
123
-    $ . env/bin/activate
124
-
125
-Get Trove
126
----------
127
-
128
-Obtain the Trove source components from OpenStack repositories:
129
-
130
-.. code-block:: bash
131
-
132
-    $ cd ~
133
-    $ git clone https://opendev.org/openstack/trove.git
134
-    $ git clone https://opendev.org/openstack/python-troveclient.git
135
-
136
-
137
-Install Trove
138
-=============
139
-
140
-First, install the requirements:
141
-
142
-.. code-block:: bash
143
-
144
-    $ cd ~/trove
145
-    $ pip install -r requirements.txt -r test-requirements.txt
146
-
147
-Then, install Trove:
148
-
149
-.. code-block:: bash
150
-
151
-    $ sudo python setup.py develop
152
-
153
-Finally, install the Trove client:
154
-
155
-.. code-block:: bash
156
-
157
-    $ cd ~/python-troveclient
158
-    $ sudo python setup.py develop
159
-    $ cd ~
160
-
161
-Other required OpenStack clients (python-novaclient, python-keystoneclient, etc.) should already be installed as part of the Trove requirements.
162
-
163
-
164
----------------------------
165
-Prepare Trove for OpenStack
166
----------------------------
167
-
168
-You will first need to create a tenant called 'trove_for_trove_usage'.
169
-Next, create users called 'regular_trove_user' and 'admin_trove_user' —using 'trove' as the password. These are the accounts used by the Trove service.
170
-Additionally, you will need to register Trove as an OpenStack service and its endpoints:
171
-
172
-.. code-block:: bash
173
-
174
-    $ openstack --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword> --os-project-name <OpenStackAdminProject> --os-domain-name <OpenstackDomainName> --os-auth-url http://<KeystoneIP>/identity project create trove_for_trove_usage
175
-
176
-    $ openstack --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword> --os-project-name <OpenStackAdminProject> --os-domain-name <OpenstackDomainName> --os-auth-url http://<KeystoneIP>/identity user create regular_trove_user --project trove_for_trove_usage --password-prompt
177
-
178
-    $ openstack --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword> --os-project-name <OpenStackAdminProject> --os-domain-name <OpenstackDomainName> --os-auth-url http://<KeystoneIP>/identity user create admin_trove_user --project trove_for_trove_usage --password-prompt
179
-
180
-    $ openstack --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword> --os-project-name <OpenStackAdminProject> --os-domain-name <OpenstackDomainName> --os-auth-url http://<KeystoneIP>/identity role add --user admin_trove_user --project trove_for_trove_usage admin
181
-
182
-    $ openstack --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword> --os-project-name <OpenStackAdminProject> --os-domain-name <OpenstackDomainName> --os-auth-url http://<KeystoneIP>/identity service create --name trove --description "Database" database
183
-
184
-    $ openstack --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword> --os-project-name <OpenStackAdminProject> --os-domain-name <OpenstackDomainName> --os-auth-url http://<KeystoneIP>/identity endpoint create --region RegionOne database public 'http://<EnvironmentPublicIP>:<EnvironmentPort>/v1.0/$(tenant_id)s'
185
-
186
-    $ openstack --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword> --os-project-name <OpenStackAdminProject> --os-domain-name <OpenstackDomainName> --os-auth-url http://<KeystoneIP>/identity endpoint create --region RegionOne database admin 'http://<EnvironmentPublicIP>:<EnvironmentPort>/v1.0/$(tenant_id)s'
187
-
188
-    $ openstack --os-username <OpenStackAdminUsername> --os-password <OpenStackAdminPassword> --os-project-name <OpenStackAdminProject> --os-domain-name <OpenstackDomainName> --os-auth-url http://<KeystoneIP>/identity endpoint create --region RegionOne database internal 'http://<EnvironmentPublicIP>:<EnvironmentPort>/v1.0/$(tenant_id)s'
189
-
190
-Where <EnvironmentPublicIP> and <EnvironmentPort> are the IP address and Port of the server where Trove was installed. This IP should be reachable from any hosts that will be used to communicate with Trove.
191
-
192
-Prepare Trove configuration files
193
-=================================
194
-
195
-There are several configuration files for Trove:
196
-
197
-- api-paste.ini and trove.conf — For trove-api service
198
-- trove-guestagent.conf — For trove-guestagent service
199
-- <datastore_manager>.cloudinit — Userdata for VMs during provisioning
200
-
201
-Cloud-init scripts are userdata that is being used for different datastore types like mysql/percona, cassandra, mongodb, redis, couchbase while provisioning new compute instances.
202
-
203
-Samples of the above are available in ~/trove/etc/trove/ as \*.conf.sample files.
204
-
205
-If a clean Ubuntu image is used as the source image for Trove instances, the cloud-init script must install and run guestagent in the instance.
206
-
207
-As an alternative, one may consider creating a custom image with pre-installed and pre-configured Trove in it.
208
-
209
-Source images
210
-=============
211
-
212
-As the source image for Trove instances, we will use a Trove-compatible Ubuntu image.
213
-Build your own Trove images, Then run the following steps:
214
-
215
-.. code-block:: bash
216
-
217
-    $ export DATASTORE_TYPE="mysql"
218
-    $ glance --os-username admin_trove_user --os-password trove --os-tenant-name trove_for_trove_usage --os-auth-url http://<KeystoneIP>:<KeystoneAdminPort>/v2.0 image-create --name trove-image --is-public True --container-format ovf --disk-format qcow2 --file ${DATASTORE_TYPE}.qcow2
219
-
220
-At this step please remember the image ID or store it in an environment variable (IMAGEID).
221
-
222
-.. code-block:: bash
223
-
224
-    $ glance --os-username trove --os-password trove --os-tenant-name trove --os-auth-url http://<KeystoneIP>:<KeystoneAdminPort>/v2.0
225
-        image-create --name trove-image --is-public true --container-format ovf --disk-format qcow2 --owner trove < precise.qcow2
226
-
227
-    $ export IMAGEID=<glance_image_id>
228
-
229
-
230
-Cloud-init scripts
231
-==================
232
-
233
--------------------
234
-Cloud-init location
235
--------------------
236
-
237
-By default, trove-taskmanager will look at /etc/trove/cloudinit for <datastore_manager>.cloudinit.
238
-
239
-------------------
240
-Cloud-init content
241
-------------------
242
-
243
-Each cloud-init script for Trove-compatible images should contain:
244
-
245
-- Trove installation
246
-
247
-Custom images with Trove code inside
248
-====================================
249
-
250
-*To be added*
251
-
252
-Prepare the database
253
-====================
254
-
255
-Create the Trove database schema:
256
-
257
-- Connect to the storage backend (MySQL, PostgreSQL)
258
-- Create a database called `trove` (this database will be used for storing Trove ORM)
259
-- Compose connection string. Example: mysql+pymysql://<user>:<password>@<backend_host>:<backend_port>/<database_name>
260
-
261
-Initialize the database
262
-=======================
263
-
264
-Once the database for Trove is created, its structure needs to be populated.
265
-
266
-.. code-block:: bash
267
-
268
-    $ trove-manage db_sync
269
-
270
-Setup Trove Datastores
271
-======================
272
-
273
----------
274
-Datastore
275
----------
276
-
277
-A Datastore is a data structure that describes a set of Datastore Versions, which consists of::
278
-
279
-    - ID -- simple auto-generated UUID
280
-    - Name -- user-defined attribute, actual name of a datastore
281
-    - Datastore Versions
282
-
283
-
284
-Example::
285
-
286
-  - mysql, cassandra, redis, etc.
287
-
288
------------------
289
-Datastore Version
290
------------------
291
-
292
-A Datastore Version is a data structure that describes a version of a specific database pinned to datastore, which consists of::
293
-
294
-    - ID — Simple auto-generated UUID
295
-    - Datastore ID — Reference to Datastore
296
-    - Name — User-defined attribute, actual name of a database version
297
-    - Datastore manager — trove-guestagent manager that is used for datastore management
298
-    - Image ID — Reference to a specific Glance image ID
299
-    - Packages — Operating system specific packages that would be deployed onto datastore VM
300
-    - Active — Boolean flag that defines if version can be used for instance deployment or not
301
-
302
-Example::
303
-
304
-  - ID - edb1d22a-b66d-4e86-be60-756240439272
305
-  - Datastore ID - 9c3d890b-a2f2-4ba5-91b2-2997d0791502
306
-  - Name - mysql-5.7
307
-  - Datastore manager - mysql
308
-  - Image ID - d73a402-3953-4721-8c99-86fc72e1cb51
309
-  - Packages - mysql-server=5.7, percona-xtrabackup=2.4
310
-  - Active - True
311
-
312
---------------------------------------------
313
-Datastore and Datastore Version registration
314
---------------------------------------------
315
-
316
-To register a datastore, you must execute:
317
-
318
-.. code-block:: bash
319
-
320
-    $ export DATASTORE_TYPE="mysql" # available options: mysql, mongodb, postgresql, redis, cassandra, couchbase, couchdb, db2, vertica, etc.
321
-
322
-    $ export DATASTORE_VERSION="5.7" # available options: for cassandra 2.0.x, for mysql: 5.x, for mongodb: 2.x.x, etc.
323
-
324
-    $ export PACKAGES="mysql-server-5.7" # available options: cassandra=2.0.9, mongodb=2.0.4, etc
325
-
326
-    $ export IMAGEID="9910350b-77e3-4790-86be-b971d0cf9175" # Glance image ID of the relevant Datastore version (see Source images section)
327
-
328
-    $ trove-manage datastore_update ${DATASTORE_TYPE} ""
329
-
330
-    $ trove-manage datastore_version_update ${DATASTORE_TYPE} ${DATASTORE_VERSION} ${DATASTORE_TYPE} ${IMAGEID} ${PACKAGES} 1
331
-
332
-    $ trove-manage datastore_update ${DATASTORE_TYPE} ${DATASTORE_VERSION}
333
-
334
-=========
335
-Run Trove
336
-=========
337
-
338
-Trove services configuration and tuning
339
-=======================================
340
-
341
-*To be added*
342
-
343
-Starting Trove services
344
-=======================
345
-
346
-Run trove-api:
347
-
348
-.. code-block:: bash
349
-
350
-    $ trove-api --config-file=${TROVE_CONF_DIR}/trove.conf &
351
-
352
-Run trove-taskmanager:
353
-
354
-.. code-block:: bash
355
-
356
-    $ trove-taskmanager --config-file=${TROVE_CONF_DIR}/trove.conf &
357
-
358
-Run trove-conductor:
359
-
360
-.. code-block:: bash
361
-
362
-   $ trove-conductor --config-file=${TROVE_CONF_DIR}/trove.conf &
363
-
364
-=================
365
-Trove interaction
366
-=================
367
-
368
-Keystonerc
369
-==========
370
-
371
-You need to build a `keystonerc` file that contains data to simplify the auth processes while using the Trove client:
372
-
373
-.. code-block:: bash
374
-
375
-        export OS_PROJECT_NAME=trove
376
-
377
-        export OS_USERNAME=regular_trove_user
378
-
379
-        export OS_PASSWORD=<UserPassword>
380
-
381
-        export OS_AUTH_URL="http://<KeystoneIP>/identity"
382
-
383
-        export OS_USER_DOMAIN_NAME=Default
384
-
385
-        export OS_PROJECT_DOMAIN_NAME=Default
386
-
387
-Trove deployment verification
388
-=============================
389
-
390
-First you need to execute:
391
-
392
-.. code-block:: bash
393
-
394
-    $ . keystonerc
395
-
396
-To see `help` for a specific command:
397
-
398
-.. code-block:: bash
399
-
400
-    $ trove help <command>
401
-
402
-To create an instance:
403
-
404
-.. code-block:: bash
405
-
406
-    $ trove create <name> <flavor>
407
-                    [--size <size>] [--volume_type <volume_type>]
408
-                    [--databases <database> [<database> ...]]
409
-                    [--users <user:password> [<user:password> ...]]
410
-                    [--backup <backup>]
411
-                    [--availability_zone <availability_zone>]
412
-                    [--datastore <datastore>]
413
-                    [--datastore_version <datastore_version>]
414
-                    [--nic <net-id=<net-uuid>,v4-fixed-ip=<ip-addr>,port-id=<port-uuid>>]
415
-                    [--configuration <configuration>]
416
-                    [--replica_of <source_instance>] [--replica_count <count>]
417
-                    [--module <module>] [--locality <policy>]
418
-
419
-===============
420
-Troubleshooting
421
-===============
422
-
423
-No instance IPs in the output of 'trove show <instance_id>'
424
-===========================================================
425
-
426
-If the Trove instance was successfully created, is showing ACTIVE state and working, yet there is no IP address for the instance shown in the output of 'trove show <instance_id>, then confirm the following lines are added to trove.conf ::
427
-
428
-    network_label_regex = ^NETWORK_NAME$
429
-
430
-where NETWORK_NAME should be replaced with real name of the network to which the instance is connected to.
431
-
432
-To decide which network would you like to attach a Trove instance to, run the following command:
433
-
434
-.. code-block:: bash
435
-
436
-   $ openstack network list
437
-
438
-One possible way to find the network name is to execute the 'nova list' command. The output will list all OpenStack instances for the tenant, including network information. Look for ::
439
-
440
-    NETWORK_NAME=IP_ADDRESS
441
-
442
-
443
-Additional information
444
-======================
445
-
446
-Additional information can be found in the OpenStack installation guide for the trove project. This document can be found under the "Installation Tutorials and Guides" section of the OpenStack Documentation.
447
-
448
-For the current documentation, visit:
449
-
450
-http://docs.openstack.org/index.html#install-guides
451
-
452
-Select the link for "Installation Tutorials and Guides"
453
-
454
-The installation guides for trove (the Database Service) can be found under the appropriate operating system.
455
-
456
-If you are interested in documentation for a specific OpenStack release, visit:
457
-
458
-http://docs.openstack.org/<release-code-name>/
459
-
460
-For example, the documentation for the Pike release is found at:
461
-
462
-http://docs.openstack.org/pike/
463
-
464
-and the documentation for the Queens release is found at:
465
-
466
-http://docs.openstack.org/queens/

Loading…
Cancel
Save