|
| 1 | +###### Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. |
| 2 | +###### Licensed under the Universal Permissive License v 1.0 as shown at <http://oss.oracle.com/licenses/upl> |
| 3 | + # ___ ____ _ ____ _ _____ |
| 4 | + # / _ \| _ \ / \ / ___| | | ____| |
| 5 | + # | | | | |_) | / _ \| | | | | _| |
| 6 | + # | |_| | _ < / ___ | |___| |___| |___ |
| 7 | + # \___/|_| \_/_/ \_\____|_____|_____| |
| 8 | +*** |
| 9 | +This quickstart guide describes utilities to rapidly deploy Oracle Times Ten Scaleout in Oracle Cloud Infrastructure (OCI). For details on how the utility works and additional options please refer to the [README.md](./README.md) file. |
| 10 | + |
| 11 | +Running the _provisionScaleoutOCI_ utility allocates the cloud resources necessary to deploy a running TimesTen Scaleout database. |
| 12 | + |
| 13 | +### Prerequisites: |
| 14 | +1. A compute instance running Oracle Linux 7, provisioned on Oracle OCI, that you can ssh into as the opc user. |
| 15 | + This is known as the "bootstrap instance". |
| 16 | + See the [Tutorial](https://docs.cloud.oracle.com/iaas/Content/GSG/Reference/overviewworkflow.htm) for creating a bootstrap instance. |
| 17 | +2. Access to an OCI compartment other than `root` or `PaaSManagedCompartment` with a policy that allows creating VCNs |
| 18 | + Please see, `Identity->Compartments` and `Identity->Policies` in the [OCI Console](https://console.us-phoenix-1.oraclecloud.com "OCI Console Phoenix") |
| 19 | + The user that runs the utility needs to be a member of a group with the following permissions for the chosen compartment: |
| 20 | + `manage virtual-network-family` |
| 21 | + `manage instance-family` |
| 22 | + `manage volume-family` |
| 23 | + Note that members of the administrator group already have permission and do not require explicitly created policies. |
| 24 | +3. Check Service limits |
| 25 | + Please visit `Governance->Service Limits` in the [OCI Console](https://console.us-phoenix-1.oraclecloud.com "OCI Console Phoenix") to ensure adequate resources are available. |
| 26 | + The minimum requirement is 1 VCN, and 4 compute instances. |
| 27 | + In addition, if using standard shapes for database compute instances, 1 block volume for each database host instance is required. |
| 28 | +4. The following OCIDs from the OCI Console: |
| 29 | + User ID, see `Identity-Users` |
| 30 | + Tenancy ID, see `Administration->Tenancy Details` |
| 31 | +5. An Oracle TimesTen In-Memory Database 18c distribution. |
| 32 | + The distribution on OTN is available at: |
| 33 | + <https://www.oracle.com/technetwork/database/database-technologies/timesten/downloads/index.html> |
| 34 | +6. Optional but not required is one of either a JRE 8 or JDK 8 distribution, if needed for your applications. |
| 35 | + The JRE distribution on OTN is available at: |
| 36 | + <https://docs.oracle.com/javase/8/docs/technotes/guides/install/linux_jre.html> |
| 37 | + The JDK distribution on OTN is available at: |
| 38 | + <https://docs.oracle.com/javase/8/docs/technotes/guides/install/linux_jdk.html> |
| 39 | +7. These scripts, available at: |
| 40 | + <https://github.com/oracle/oracle-timesten-samples> |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +### An example of using this utility |
| 45 | +* Copy a timesten distribution up to your bootstrap instance. |
| 46 | + `scp timesten181130.server.linux8664.zip [email protected]:` |
| 47 | + |
| 48 | +* ssh into the bootstrap instance as the opc user, e.g |
| 49 | + |
| 50 | + |
| 51 | +* Install terraform, the OCI Python SDK and CLI, and git. |
| 52 | +`% sudo yum install -y terraform python-oci-sdk python-oci-cli git` |
| 53 | + |
| 54 | +* Create an .oci/config file for terraform to access OCI resources. |
| 55 | + If you already have a .oci/config file then copy it up to the bootstrap instance. |
| 56 | + `% scp -qr ~/.oci/config [email protected]:.oci` |
| 57 | + Otherwise generate one with the following. |
| 58 | + `% oci setup config` |
| 59 | + You will need to select a region and provide OCIDs for the user and tenancy. |
| 60 | + For the cloud user, display the public API key and add it to Identity->Users->Add Public Key. |
| 61 | + `% cat ~/.oci/oci_api_key_public.pem # paste to Identity->Users` |
| 62 | + |
| 63 | +* Download the scripts https://github.com/oracle/oracle-timesten-samples |
| 64 | + `git clone https://github.com/oracle/oracle-timesten-samples` |
| 65 | + |
| 66 | +* Change to the ottscaleout directory |
| 67 | + `% cd oracle-timesten-samples/cloud/ottscaleout` |
| 68 | + |
| 69 | +* Copy the timesten distribution into service/packages |
| 70 | +`% cp ~/timesten181130.server.linux8664.zip service/packages` |
| 71 | + |
| 72 | +* Run the _provisionScaleoutOCI_ script from the ottscaleout directory |
| 73 | +`% ./provisionScaleoutOCI` |
| 74 | + |
| 75 | +### Example session |
| 76 | +``` |
| 77 | +% scp timesten181130.server.linux8664.zip [email protected]: |
| 78 | +The authenticity of host '123.123.123.123 (123.123.123.123)' can't be established. |
| 79 | +ECDSA key fingerprint is SHA256:... |
| 80 | +ECDSA key fingerprint is MD5:... |
| 81 | +Are you sure you want to continue connecting (yes/no)? yes |
| 82 | +Warning: Permanently added '123.123.123.123' (ECDSA) to the list of known hosts. |
| 83 | +% |
| 84 | + |
| 85 | +Last login: Fri Dec 7 00:00:00 2018 from 8.8.8.8 |
| 86 | +[opc@bootstrap ~]$ |
| 87 | +[opc@bootstrap ~]$ sudo yum install -y terraform python-oci-sdk python-oci-cli git |
| 88 | +Loaded plugins: langpacks, ulninfo |
| 89 | +Complete! |
| 90 | +[opc@bootstrap ~]$ |
| 91 | +[opc@bootstrap ~]$ oci setup config |
| 92 | + This command provides a walkthrough of creating a valid CLI config file. |
| 93 | +
|
| 94 | + The following links explain where to find the information required by this |
| 95 | + script: |
| 96 | +
|
| 97 | + User OCID and Tenancy OCID: |
| 98 | +
|
| 99 | + https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#Other |
| 100 | +
|
| 101 | + Region: |
| 102 | +
|
| 103 | + https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm |
| 104 | +
|
| 105 | + General config documentation: |
| 106 | +
|
| 107 | + https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm |
| 108 | +
|
| 109 | +
|
| 110 | +Enter a location for your config [/home/opc/.oci/config]: |
| 111 | +Enter a user OCID: ocid1.user.oc1..... |
| 112 | +Enter a tenancy OCID: ocid1.tenancy.oc1..... |
| 113 | +Enter a region (e.g. eu-frankfurt-1, uk-london-1, us-ashburn-1, us-phoenix-1): us-ashburn-1 |
| 114 | +Do you want to generate a new RSA key pair? (If you decline you will be asked to supply the path to an existing key.) [Y/n]: Y |
| 115 | +Enter a directory for your keys to be created [/home/opc/.oci]: |
| 116 | +Enter a name for your key [oci_api_key]: |
| 117 | +Public key written to: /home/opc/.oci/oci_api_key_public.pem |
| 118 | +Enter a passphrase for your private key (empty for no passphrase): |
| 119 | +Private key written to: /home/opc/.oci/oci_api_key.pem |
| 120 | +Fingerprint: 1a:1a:1a:1a:... |
| 121 | +Config written to /home/opc/.oci/config |
| 122 | +
|
| 123 | +
|
| 124 | + If you haven't already uploaded your public key through the console, |
| 125 | + follow the instructions on the page linked below in the section 'How to |
| 126 | + upload the public key': |
| 127 | +
|
| 128 | + https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#How2 |
| 129 | +
|
| 130 | +
|
| 131 | +[opc@bootstrap ~]$ cat ~/.oci/oci_api_key_public.pem # paste to Identity->Users |
| 132 | +-----BEGIN PUBLIC KEY----- |
| 133 | +XYZ... |
| 134 | +... |
| 135 | +-----END PUBLIC KEY----- |
| 136 | +[opc@bootstrap ~]$ |
| 137 | +[opc@bootstrap ~]$ git clone https://github.com/oracle/oracle-timesten-samples |
| 138 | +Cloning into 'oracle-timesten-samples'... |
| 139 | +remote: Enumerating objects: nnn, done. |
| 140 | +remote: Counting objects: 100%, done. |
| 141 | +remote: Compressing objects: 100%, done. |
| 142 | +remote: Total (delta ), reused (delta ), pack-reused |
| 143 | +Receiving objects: 100% (/), MiB | MiB/s, done. |
| 144 | +Resolving deltas: 100% (/), done. |
| 145 | +[opc@bootstrap ~]$ |
| 146 | +[opc@bootstrap ~]$ cd oracle-timesten-samples/cloud/ottscaleout |
| 147 | +[opc@bootstrap ottscaleout]$ |
| 148 | +[opc@bootstrap ottscaleout]$ ./provisionScaleoutOCI |
| 149 | +
|
| 150 | +Checking OCI API configuration ... |
| 151 | +
|
| 152 | +Checking SSH configuration |
| 153 | +
|
| 154 | +Checking TimesTen scripts ... |
| 155 | +- OK : scripts version v3_180123_18.1.2.0.0 installed. |
| 156 | +
|
| 157 | +Checking Terraform installation ... |
| 158 | +- OK : Terraform version 0.11.11 in /usr/bin/terraform |
| 159 | +
|
| 160 | +
|
| 161 | +Are you using an OCI trial or pay-as-you-go account ? [ no ] |
| 162 | +
|
| 163 | +What would you like to name this service : [ ttimdb1 ] |
| 164 | +
|
| 165 | +Service name set to 'ttimdb1' |
| 166 | +
|
| 167 | +Of the following 3 compartments : |
| 168 | +
|
| 169 | +1. dev1 |
| 170 | +2. dev2 |
| 171 | +3. QA1 |
| 172 | +
|
| 173 | +Which compartment would you like to use ? [ 1 ] 2 |
| 174 | +
|
| 175 | +Compartment set to 'dev2' |
| 176 | +
|
| 177 | +Of the following 4 regions : |
| 178 | +
|
| 179 | +1. eu-frankfurt-1 |
| 180 | +2. us-ashburn-1 |
| 181 | +3. uk-london-1 |
| 182 | +4. us-phoenix-1 |
| 183 | +
|
| 184 | +Which region would you like to use ? [ 2 ] |
| 185 | +
|
| 186 | +Region set to 'us-ashburn-1' |
| 187 | +
|
| 188 | +Please select one of the following 'High Availability' options : |
| 189 | +
|
| 190 | +1. Best performance - all data instances in one 'Availability Domain' |
| 191 | +2. Best availability - data instances distributed across 'Availability Domains' |
| 192 | +
|
| 193 | +Which option would you like to choose ? [ 1 ] |
| 194 | +
|
| 195 | +Data instances will NOT span 'Availability Domains' |
| 196 | +
|
| 197 | +Which 'Availability Domain' do you want to use (1, 2, or 3) ? [ 1 ] 2 |
| 198 | +
|
| 199 | +Found an existing TimesTen Scaleout distribution : |
| 200 | +
|
| 201 | +/home/opc/timesten/ttimdb1/service/packages/timesten181210.server.linux8664.zip |
| 202 | +
|
| 203 | +Would you like to use this TimesTen Scaleout distribution ? [ y ] |
| 204 | +
|
| 205 | +Number of Replica Sets |
| 206 | +---------------------- |
| 207 | +
|
| 208 | +* There are two data instances per replica set for high availability |
| 209 | +* The number of data instances determines the database capacity and SQL parallelism |
| 210 | +
|
| 211 | +NOTE: Please check the OCI console's "Governance->Service Limits" page to ensure that |
| 212 | + you have sufficient resources to provision the desired number and type of compute instances. |
| 213 | +
|
| 214 | +How many replica sets would you like to create (1 replica set = 2 data instances) ? [ 2 ] |
| 215 | +
|
| 216 | +Number of replica sets = 2 (4 data instances) |
| 217 | +
|
| 218 | +**** Fast IO [NVMe disk] |
| 219 | +
|
| 220 | +Shape | Memory | OCPU | DB SIZE |
| 221 | +----------------------------------------------- |
| 222 | +
|
| 223 | +1. VM.DenseIO2.8 | 120 GB | 8 | 60 GB |
| 224 | +2. VM.DenseIO2.16 | 240 GB | 16 | 120 GB |
| 225 | +3. VM.DenseIO2.24 | 320 GB | 24 | 160 GB |
| 226 | +4. BM.DenseIO2.52 | 768 GB | 52 | 384 GB |
| 227 | +
|
| 228 | +**** Standard IO [Block Storage] |
| 229 | +
|
| 230 | +Shape | Memory | OCPU | DB SIZE |
| 231 | +----------------------------------------------- |
| 232 | +
|
| 233 | +5. VM.Standard2.2 | 30 GB | 2 | 15 GB |
| 234 | +6. VM.Standard2.4 | 60 GB | 4 | 30 GB |
| 235 | +
|
| 236 | +NOTE: Please check the OCI console's "Governance->Service Limits" or "Tenancy->Service Limits" page |
| 237 | + to ensure that you have sufficient resources to provision the desired VM shape. |
| 238 | +
|
| 239 | +
|
| 240 | +Choose the shape for data instances [ 1 ] 5 |
| 241 | +
|
| 242 | +Data instances will use shape : VM.Standard2.2 |
| 243 | +
|
| 244 | +Provide the block volume size in GB (more than 50GB, less than 5000GB) ? [ 90 ] |
| 245 | +
|
| 246 | +Block volume size will be 90GB |
| 247 | +
|
| 248 | +-- SUMMARY -- |
| 249 | +
|
| 250 | +Service Name ttimdb1 |
| 251 | +Scaleout Install timesten181210.server.linux8664.zip |
| 252 | +Compartment dev2 |
| 253 | +Region us-ashburn-1 |
| 254 | +OS Image Oracle-Linux-7.6-2019.01.17-0 |
| 255 | +Data Instance Shape VM.Standard2.2 |
| 256 | +Span Availability Domains No (AD-2) |
| 257 | +Database Size 15GB |
| 258 | +Block volume size 90GB |
| 259 | +Number of Replica Sets 2 |
| 260 | +Number of Data Instances 4 |
| 261 | +TOTAL NUMBER OF COMPUTE INSTANCES 5 (4 data + 1 bastion) |
| 262 | +
|
| 263 | +Proceed ? [ y ] y |
| 264 | +
|
| 265 | +Running Terraform ... |
| 266 | +- 'terraform init' : OK (/home/opc/timesten/ttimdb1/init.out) |
| 267 | +- 'terraform plan' : OK (/home/opc/timesten/ttimdb1/plan.out) |
| 268 | +- 'terraform apply': OK (/home/opc/timesten/ttimdb1/apply.out) |
| 269 | +
|
| 270 | +Terraform runtime was 0:04:02 |
| 271 | +
|
| 272 | +Running Ansible scripts on remote host (/home/opc/timesten/ttimdb1/ansible.out) |
| 273 | +
|
| 274 | +This step may take longer than 10 minutes. |
| 275 | +
|
| 276 | +OK (/home/opc/timesten/ttimdb1/ansible.out) |
| 277 | +
|
| 278 | +Ansible runtime was 0:08:52 |
| 279 | +
|
| 280 | +######################################## |
| 281 | +# Bastion Hosts |
| 282 | +######################################## |
| 283 | +
|
| 284 | +Hostname Public IP Private IP Shape |
| 285 | +----------------------------------- --------------- --------------- |
| 286 | +ttimdb1-bs-001 1.2.3.4 172.16.0.2 VM.Standard2.1 |
| 287 | +
|
| 288 | +######################################## |
| 289 | +# Management Instances |
| 290 | +######################################## |
| 291 | +
|
| 292 | +Hostname Public IP Private IP Shape |
| 293 | +----------------------------------- --------------- --------------- |
| 294 | +ttimdb1-di-001 |
| 295 | +
|
| 296 | +Total provisioning time was 0:12:54 |
| 297 | +
|
| 298 | +### Example of accessing the provisioned resources. |
| 299 | +
|
| 300 | +[opc@bootstrap ottscaleout]$ |
| 301 | +[opc@bootstrap ottscaleout]$ cd ~/timesten/ttimdb1 |
| 302 | +[opc@bootstrap ttimdb1]$ ls |
| 303 | +ansible.out env-vars.orig plan.out public.tf service variables.tf |
| 304 | +apply.out init.out private.tf README.md system-config.tf variables.tf.orig |
| 305 | +env-vars outputs.tf provisionScaleoutOCI scaleout.out terraform.tfstate |
| 306 | +[opc@bootstrap ttimdb1]$ |
| 307 | +[opc@bootstrap ttimdb1]$ terraform output |
| 308 | +InstanceIPAddresses = [ |
| 309 | + bastion host instances (public addresses): |
| 310 | + |
| 311 | + , |
| 312 | + database [mgmt|zookeeper] hosts (private addresses): |
| 313 | + ttimdb1-di-001 172.16.48.2 |
| 314 | + ttimdb1-di-002 172.16.64.2 |
| 315 | + ttimdb1-di-003 172.16.48.3 |
| 316 | + ttimdb1-di-004 172.16.64.3 |
| 317 | + , |
| 318 | + client host instances (private addresses): |
| 319 | + |
| 320 | +] |
| 321 | +[opc@bootstrap ttimdb1]$ ssh [email protected] |
| 322 | +Last login: Wed Dec 5 20:42:05 2018 from 123.123.123.123 |
| 323 | +[opc@ttimdb1-bs-001 ~]$ |
| 324 | +[opc@ttimdb1-bs-001 ~]$ ssh -tt ttimdb1-di-001 sudo su - oracle |
| 325 | +[oracle@ttimdb1-di-001 ~]$ |
| 326 | +[oracle@ttimdb1-di-001 ~]$ /u10/TimesTen/ttimdb1/instance1/bin/ttenv ttisql dsn=ttimdb1 |
| 327 | +... |
| 328 | +connect "dsn=ttimdb1"; |
| 329 | +... |
| 330 | +Command> |
| 331 | +... |
| 332 | +``` |
| 333 | +### Restrictions: |
| 334 | + |
| 335 | +Use either the _provisionScaleoutOCI_ utility OR use the underlying Terraform-Ansible scripts directly to provision a database. |
| 336 | +Advanced users may wish to run the _provisionScaleoutOCI_ utility to satisfy the prerequisite setup such as |
| 337 | +generating API keys, then use the underlying Terraform-Ansible scripts as described in the [README.md](./README.md) file. |
| 338 | + |
| 339 | +### Troubleshooting the _provisionScaleoutOCI_ utility: |
| 340 | + |
| 341 | +Errors encountered during provisioning may be transient ones, such as ssh connectivity or port in use errors. |
| 342 | +Rather than destroying the configuration, Terraform or Ansible can often be rerun to correct such errors. |
| 343 | +Check the _apply.out_ and _ansible.out_ files in the directory created for the service for the specific error. |
| 344 | +From the example above, where the service name is 'ttimdb1': |
| 345 | +* `cd ~/timesten/ttimdb1` |
| 346 | +Setup the environment |
| 347 | +* `. ./env-vars` |
| 348 | +If Terraform failed during apply, to rerun Terraform: |
| 349 | +* `terraform apply --auto-approve` |
| 350 | +If Terraform succeeds but Ansible failed: |
| 351 | +Determine the address of the bastion host by running: |
| 352 | +* `terraform output` |
| 353 | +Login to the bastion host |
| 354 | + |
| 355 | +Move to ansible directory |
| 356 | +* `cd service/ansible` |
| 357 | +Destroy a potentially partially created database, ignoring errors. |
| 358 | +* `ansible-playbook -i hosts dbdestroy.yaml` |
| 359 | +Retry Database rollout |
| 360 | +* `ansible-playbook -i hosts rollout.yaml 2>&1 | tee rollout.out` |
| 361 | +Continued failure at this point requires deeper examination of the log files. |
| 362 | + |
| 363 | +### |
| 364 | + |
| 365 | +See the accompanying [README.md](./README.md) file for more information on using the provisioned resources and TimesTen Scaleout database. |
0 commit comments