Support Questions

Find answers, ask questions, and share your expertise

Save Ambary setting in Docker container (Spark version) after restart

avatar
Explorer

Hi all! I am new in all this stuff. I am using the latest Sandbox.

I need to start Spark2 service by default. I stopped Spark 1.6 in Ambari (via web interface) and started Spark2 instead.

After that I commit changes to Docker container.

But after restarting - I have Spark 1.6 started again 😞 The same things with my CPU and memory settings.

Could you please guide me to point where I can find settings for Ambari in some configuration file (or something like that).

Thanks a lot in advance!

1 ACCEPTED SOLUTION

avatar
Super Guru

@Yurii Tymchii

The issue you are seeing is the sandbox uses a start script (/etc/init.d/startup_script) to start the services, but it really just calls a chain of other scripts. Even though you have stopped Spark 1.6, when the sandbox starts up again it makes the call to start Spark 1.6 automatically.

I haven't yet found exactly where Spark is starting. As I said, the chain of script calling is a little more complex than I expected.

What I do in my sandboxes is to create a couple of scripts that use the Ambari REST API to start/stop extra services.

I'm not using Flume, so I created a script called "stop_flume.sh" on my sandbox. After I run the startup_script, I then run the stop_flume.sh script.

Here is my script:

USERNAME=admin
PASSWORD=admin
CLUSTER=Sandbox

echo "Stopping FLUME"

# Turn off maintenance mode
curl -u $USERNAME:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Turn OFF Maintenance Mode for FLUME via REST"}, "Body": {"ServiceInfo": {"maintenance_state": "OFF"}}}' http://`hostname -f`:8080/api/v1/clusters/$CLUSTER/services/FLUME

sleep 5

# Stopping a service is actually setting the state to INSTALLED
curl -u $USERNAME:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Start FLUME via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' http://`hostname -f`:8080/api/v1/clusters/$CLUSTER/services/FLUME

sleep 5

# Turn on maintenance mode
curl -u $USERNAME:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Turn OFF Maintenance Mode for FLUME via REST"}, "Body": {"ServiceInfo": {"maintenance_state": "ON"}}}' http://`hostname -f`:8080/api/v1/clusters/$CLUSTER/services/FLUME

View solution in original post

1 REPLY 1

avatar
Super Guru

@Yurii Tymchii

The issue you are seeing is the sandbox uses a start script (/etc/init.d/startup_script) to start the services, but it really just calls a chain of other scripts. Even though you have stopped Spark 1.6, when the sandbox starts up again it makes the call to start Spark 1.6 automatically.

I haven't yet found exactly where Spark is starting. As I said, the chain of script calling is a little more complex than I expected.

What I do in my sandboxes is to create a couple of scripts that use the Ambari REST API to start/stop extra services.

I'm not using Flume, so I created a script called "stop_flume.sh" on my sandbox. After I run the startup_script, I then run the stop_flume.sh script.

Here is my script:

USERNAME=admin
PASSWORD=admin
CLUSTER=Sandbox

echo "Stopping FLUME"

# Turn off maintenance mode
curl -u $USERNAME:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Turn OFF Maintenance Mode for FLUME via REST"}, "Body": {"ServiceInfo": {"maintenance_state": "OFF"}}}' http://`hostname -f`:8080/api/v1/clusters/$CLUSTER/services/FLUME

sleep 5

# Stopping a service is actually setting the state to INSTALLED
curl -u $USERNAME:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Start FLUME via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' http://`hostname -f`:8080/api/v1/clusters/$CLUSTER/services/FLUME

sleep 5

# Turn on maintenance mode
curl -u $USERNAME:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Turn OFF Maintenance Mode for FLUME via REST"}, "Body": {"ServiceInfo": {"maintenance_state": "ON"}}}' http://`hostname -f`:8080/api/v1/clusters/$CLUSTER/services/FLUME