Created 02-21-2018 02:56 PM
how to automate the question ( we need to set it as always yes )
- have made a backup of the Ambari Server database [y/n] (y)
when performing ambari-server upgrade
we need to automate this because we use the ambari-server upgrade in bash script
ambari-server upgrade Using python /usr/bin/pythonUpgrading ambari-serverINFO: Upgrade Ambari ServerINFO: Updating Ambari Server properties in ambari.properties ...WARNING: Can not find ambari.properties.rpmsave file from previous version, skipping import of settingsINFO: Updating Ambari Server properties in ambari-env.sh ...INFO: Can not find ambari-env.sh.rpmsave file from previous version, skipping restore of environment settings. ambari-env.sh may not include any user customization.INFO: Fixing database objects ownerAmbari Server configured for Embedded Postgres. Confirm you have made a backup of the Ambari Server database [y/n] (y)? INFO: Upgrading database schemaINFO: Return code from schema upgrade command, retcode = 0INFO: Console output from schema upgrade command:INFO: {"lzo_enabled":"false"}INFO: Schema upgrade completedAdjusting ambari-server permissions and ownership...Ambari Server 'upgrade' completed successfully.
Created 02-22-2018 12:10 AM
You can use "expect" utility offered by Linux as following:
1. Install that package:
# yum install expect -y
2. Create a file as following as "/tmp/test.sh"
#!/usr/bin/expect set timeout 20 spawn /usr/sbin/ambari-server upgrade expect "Ambari Server configured for Postgres. Confirm you have made a backup of the Ambari Server database" { send "y\n" } interact
Notice i am passing "y". here { send "y\n" } which means it will take my input as "yes"
3. Give execute permission to the script and then run it
# chmod 755 /tmp/test.sh # /tmp/test.sh OUTPUT: --------- # /tmp/test.sh spawn /usr/sbin/ambari-server upgrade Using python /usr/bin/python Upgrading ambari-server INFO: Upgrade Ambari Server INFO: Updating Ambari Server properties in ambari.properties ... WARNING: Can not find ambari.properties.rpmsave file from previous version, skipping import of settings INFO: Updating Ambari Server properties in ambari-env.sh ... INFO: Can not find ambari-env.sh.rpmsave file from previous version, skipping restore of environment settings. ambari-env.sh may not include any user customization. INFO: Fixing database objects owner Ambari Server configured for Postgres. Confirm you have made a backup of the Ambari Server database [y/n] (y)? y INFO: Upgrading database schema INFO: Return code from schema upgrade command, retcode = 0 INFO: Schema upgrade completed Adjusting ambari-server permissions and ownership... Ambari Server 'upgrade' completed successfully.
Notice i am passing "y". here { send "y\n" } which means it will take my input as "yes"
.
Created 02-22-2018 12:10 AM
You can use "expect" utility offered by Linux as following:
1. Install that package:
# yum install expect -y
2. Create a file as following as "/tmp/test.sh"
#!/usr/bin/expect set timeout 20 spawn /usr/sbin/ambari-server upgrade expect "Ambari Server configured for Postgres. Confirm you have made a backup of the Ambari Server database" { send "y\n" } interact
Notice i am passing "y". here { send "y\n" } which means it will take my input as "yes"
3. Give execute permission to the script and then run it
# chmod 755 /tmp/test.sh # /tmp/test.sh OUTPUT: --------- # /tmp/test.sh spawn /usr/sbin/ambari-server upgrade Using python /usr/bin/python Upgrading ambari-server INFO: Upgrade Ambari Server INFO: Updating Ambari Server properties in ambari.properties ... WARNING: Can not find ambari.properties.rpmsave file from previous version, skipping import of settings INFO: Updating Ambari Server properties in ambari-env.sh ... INFO: Can not find ambari-env.sh.rpmsave file from previous version, skipping restore of environment settings. ambari-env.sh may not include any user customization. INFO: Fixing database objects owner Ambari Server configured for Postgres. Confirm you have made a backup of the Ambari Server database [y/n] (y)? y INFO: Upgrading database schema INFO: Return code from schema upgrade command, retcode = 0 INFO: Schema upgrade completed Adjusting ambari-server permissions and ownership... Ambari Server 'upgrade' completed successfully.
Notice i am passing "y". here { send "y\n" } which means it will take my input as "yes"
.
Created 12-04-2018 10:10 AM
You could make use of option "-s" or "--silent",
like in
ambari-server upgrade -s