Sun Microsystems, Inc.  Oracle System Handbook - ISO 7.0 May 2018 Internal/Partner Edition
   Home | Current Systems | Former STK Products | EOL Systems | Components | General Info | Search | Feedback

Asset ID: 1-79-1615029.1
Update Date:2016-10-11
Keywords:

Solution Type  Predictive Self-Healing Sure

Solution  1615029.1 :   Tips to Execute Commands that Require User Input using dcli on Oracle Big Data Appliance(BDA)  


Related Items
  • Big Data Appliance Hardware
  •  
Related Categories
  • PLA-Support>Eng Systems>BDA>Big Data Appliance>DB: BDA_EST
  •  




In this Document
Purpose
Scope
Details
 Overview
 Tips
References


Applies to:

Big Data Appliance Hardware - Version All Versions and later
Linux x86-64

Purpose

This document provides tips on how to execute commands that need user input using dcli(distributed command line interface) utility on Oracle Big Data Appliance(BDA)

Scope

 Oracle Big Data Appliance Administrators, Oracle Advanced Customer Support (ACS), etc...

Details

Overview

The dcli utility requires a passwordless Secure Shell (SSH) between the local server and all target servers. The dcli utility is run on the local server, and the commands specified in dcli execute on the target servers.

For details about using dcli on Oracle Big Data Appliance refer to Doc ID 1476008.1

For details about setting up dcli on All Nodes in a Oracle Big Data Appliance Cluster refer to Doc ID 1535416.1

dcli doesn't work with commands that require user interaction.

For example

a) Executing fsck command using dcli will result in below error 

e2fsck: need terminal for interactive repairs

b) Executing yum command using dcli will not wait for user input and exit 

<NodeIP>: Is this ok [y/N]: Exiting on user Command
<NodeIP>: Complete!

Tips

Here are some tips on how to execute commands that need user input using dcli by passing static input

1) Check if the command being executed has an option to execute without the need for user interaction

For example

a) With yum command -y option can be passed so the no user input is needed 

# yum --help
....
-y                    answer yes for all questions

Sample command:

To install sqoop2 rpms from BDA repository

# dcli -C 'yum -y install sqoop2' 
...
<NodeIP>: ================================================================================
<NodeIP>: Package           Arch       Version                             Repository
<NodeIP>: Size
<NodeIP>: ================================================================================
<NodeIP>: Installing:
<NodeIP>: sqoop2            noarch     1.99.2+98-1.cdh4.5.0.p0.19.el5      bda     7.3 M
<NodeIP>: Installing for dependencies:
<NodeIP>: sqoop2-client     noarch     1.99.2+98-1.cdh4.5.0.p0.19.el5      bda     6.8 M
<NodeIP>:
<NodeIP>: Transaction Summary
<NodeIP>: ================================================================================
<NodeIP>: Install       2 Package(s)
<NodeIP>: Upgrade       0 Package(s)
<NodeIP>:
<NodeIP>: Total download size: 14 M
<NodeIP>: Downloading Packages:
<NodeIP>: --------------------------------------------------------------------------------
<NodeIP>: Total                                            87 MB/s |  14 MB     00:00
<NodeIP>: Running rpm_check_debug
<NodeIP>: Running Transaction Test
<NodeIP>: Finished Transaction Test
<NodeIP>: Transaction Test Succeeded
<NodeIP>: Running Transaction
<NodeIP>: Installing     : sqoop2-client                                            1/2
<NodeIP>: Installing     : sqoop2                                                   2/2
<NodeIP>:
<NodeIP>: Installed:
<NodeIP>: sqoop2.noarch 0:1.99.2+98-1.cdh4.5.0.p0.19.el5
<NodeIP>:
<NodeIP>: Dependency Installed:
<NodeIP>: sqoop2-client.noarch 0:1.99.2+98-1.cdh4.5.0.p0.19.el5
<NodeIP>:
<NodeIP>: Complete! 

b) With fsck command -p option can be passed to automatically fix any filesystem problems that can be safely fixed without human intervention.

# fsck --help
....
 -p                   Automatic repair (no questions)

From  http://linux.die.net/man/8/fsck.ext3 

-p   Automatically repair ("preen") the file system. This option will cause e2fsck to automatically fix any filesystem problems that can be safely fixed without human intervention. If e2fsck discovers a problem   which may require the system administrator to take additional corrective action, e2fsck will print a description of the problem and then exit with the value 4 logically or'ed into the exit code. (See the EXIT CODE section.) This option is normally used by the system's boot scripts

Sample Command:

Say below warning is reported on all nodes of the BDA cluster   

WARNING: Wrong internal USB ext3 partition check : BDAUSB has gone 270 days without being checked

Follow below steps to execute a filesystem check on all nodes in the cluster using dcli in one go

i) Verify USB filesystem name with "ls -l /dev/disk/by-label" 

# dcli -C 'ls -l /dev/disk/by-label | grep -i usb' 
<NodeIP>: lrwxrwxrwx 1 root root 10 Jan  9 17:54 BDAUSB -> ../../sdm1
.....
<NodeIP>: lrwxrwxrwx 1 root root 10 Jan  9 17:51 BDAUSB -> ../../sdm1

ii) Execute filesystem check command 

# dcli -C 'fsck.ext3 -p /dev/sdm1'
<NodeIP>: BDAUSB: clean, 142311/489600 files, 893054/978290 blocks
......
<NodeIP>: BDAUSB: clean, 142311/489600 files, 893056/978290 blocks

 
2) If the command being executed doesn't have an option to skip user input then pass in required static value via stdin e.g. 'echo "value" | cmd' or 'yes "value" | cmd'

Sample Command:

a) To remove sqoop2 rpms using 'echo "value" | cmd' option 

# dcli -C 'echo "y" | yum remove sqoop2'
  
.....
<NodeIP>: ================================================================================
<NodeIP>: Package    Arch       Version                              Repository     Size
<NodeIP>: ================================================================================
<NodeIP>: Removing:
<NodeIP>: sqoop2     noarch     1.99.2+98-1.cdh4.5.0.p0.19.el5       installed     7.8 M
<NodeIP>:
<NodeIP>: Transaction Summary
<NodeIP>: ================================================================================
<NodeIP>: Remove        1 Package(s)
<NodeIP>: Reinstall     0 Package(s)
<NodeIP>: Downgrade     0 Package(s)
<NodeIP>:
<NodeIP>: Is this ok [y/N]: Downloading Packages:
<NodeIP>: Running rpm_check_debug
<NodeIP>: Running Transaction Test
<NodeIP>: Finished Transaction Test
<NodeIP>: Transaction Test Succeeded
<NodeIP>: Running Transaction
<NodeIP>: Erasing        : sqoop2                                                   1/1
<NodeIP>:
<NodeIP>: Removed:
<NodeIP>: sqoop2.noarch 0:1.99.2+98-1.cdh4.5.0.p0.19.el5
<NodeIP>:
<NodeIP>: Complete! 

b) To remove sqoop2 rpms using 'yes "value"  | cmd' option . "yes" command sends the same string as many times as needed.

# dcli -C 'yes "y" | yum remove sqoop2-client' 
.............
<NodeIP>: ================================================================================
<NodeIP>: Package         Arch     Version                             Repository   Size
<NodeIP>: ================================================================================
<NodeIP>: Removing:
<NodeIP>: sqoop2-client   noarch   1.99.2+98-1.cdh4.5.0.p0.19.el5      installed   7.6 M
<NodeIP>:
<NodeIP>: Transaction Summary
<NodeIP>: ================================================================================
<NodeIP>: Remove        1 Package(s)
<NodeIP>: Reinstall     0 Package(s)
<NodeIP>: Downgrade     0 Package(s)
<NodeIP>:
<NodeIP>: Is this ok [y/N]: Downloading Packages:
<NodeIP>: Running rpm_check_debug
<NodeIP>: Running Transaction Test
<NodeIP>: Finished Transaction Test
<NodeIP>: Transaction Test Succeeded
<NodeIP>: Running Transaction
<NodeIP>: Erasing        : sqoop2-client                                            1/1
<NodeIP>:
<NodeIP>: Removed:
<NodeIP>: sqoop2-client.noarch 0:1.99.2+98-1.cdh4.5.0.p0.19.el5
<NodeIP>:
<NodeIP>: Complete!


References

<NOTE:1476008.1> - Using DCLI on Oracle Big Data Appliance
<NOTE:1535416.1> - Steps to Setup dcli on All Nodes in a Oracle Big Data Appliance Cluster

Attachments
This solution has no attachment
  Copyright © 2018 Oracle, Inc.  All rights reserved.
 Feedback