Support Questions

Find answers, ask questions, and share your expertise

Ambari 2.6 invokes public repository inspite of registering with local repository using Rest API

avatar
Contributor


I have ambari 2.6 local repositroy map as below but during installation, public repository being invoked by the ambari and do not use local repository which I have registered using Rest API. I followed this link :

1) https://community.hortonworks.com/articles/47170/automate-hdp-installation-using-ambari-blueprints.h...
2) https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.0.0/bk_ambari-release-notes/content/ambari_reln...


Please help me, as I do not want to use public repository

curl -i -H "X-Requested-By: ambari" -u admin:admin -X PUT \
-d'{ "Repositories" : {"repo_name":"HDP-2.5.0.0","base_url":"http://192.168.56.104/HDP/centos6", "verify_base_url":true }}' \ http://master.zdp.com:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/redhat6/repositories/HDP...

curl -i -H "X-Requested-By: ambari" -u admin:admin -X PUT \
-d'{ "Repositories" : {"repo_name":"HDP-UTILS-1.1.0.21","base_url":"http://192.168.56.104/hdpu", "verify_base_url":true }}' \ http://master.zdp.com:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/redhat6/repositories/HDP...

[root@master aut]# more hostmapping.json
{
"blueprint" : "single-node-hdp-cluster",
"repository_version_id": 1,
"default_password" : "admin",
"host_groups" :[
{
"name" : "host_group_1",
"hosts" : [
{
"fqdn" : "master.zdp.com"
}
]
}
]
}

[root@master aut]# cat /etc/yum.repos.d/ambari-hdp-1.repo
[HDP-2.5-repo-1]
name=HDP-2.5-repo-1
baseurl=http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.5.0.0-1245

path=/
enabled=1
gpgcheck=0
[HDP-UTILS-1.1.0.21-repo-1]
name=HDP-UTILS-1.1.0.21-repo-1
baseurl=http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos6

path=/
enabled=1



1 ACCEPTED SOLUTION

avatar

Hi @Kalyan Das
Does this work as expected if you modify the VDF xml file with your local repo location?

View solution in original post

7 REPLIES 7

avatar
Master Mentor

@Kalyan Das

I didn't see the repos registration step in the snippet you shared

Create an internal HDP repository

called repo.json with the below contents

{
"Repositories":{
"base_url":"http://<s3.amazonaws.com-repo-server>/hdp/centos6/HDP-2.6.3.0",
"verify_base_url":true
}
} 

Create an internal hdputils-repo

called hdputils-repo.json with below contents

{
"Repositories":{
"base_url":"http://<s3.amazonaws.com-repo-server>/hdp/centos6/HDP-UTILS-1.1.0.21",
"verify_base_url":true
}
} 

Register your blueprint with ambari server

Setup Internal repo via REST API

curl -H "X-Requested-By: ambari"-X PUT -u admin:admin http://<ambari-server-hostname>:8080/api/v1/stacks/HDP/versions/2.6/operating_systems/redhat6/reposi... -d @repo.json 

Then

curl -H "X-Requested-By: ambari"-X PUT -u admin:admin http://<ambari-server-hostname>:8080/api/v1/stacks/HDP/versions/2.6/operating_systems/redhat6/reposi... -d @hdputils-repo.json

In the above example, you are executing the commands from within the directory where your repo.json and hdputils-repo.json make sure the HDP bits are accessible when you hit the below URL'S

http://<s3.amazonaws.com-repo-server>/hdp/centos6/HDP-UTILS-1.1.0.21

http://<s3.amazonaws.com-repo-server>/hdp/centos6/HDP-2.6.3.0

Kuldeep Kulkarni has a great document on the process

avatar

Hi @Kalyan Das
Does this work as expected if you modify the VDF xml file with your local repo location?

avatar
Contributor

Yes @Jonathan Sneep I have uploaded the VDF file from the same local repository, but it takes public repository when I start cluster installation using REST API. I used this command to register VDF file.


curl -v -k -u admin:admin -H "X-Requested-By:ambari" -X POST \
http://master.zdp.com:8080/api/v1/version_definitions \
-d '{
"VersionDefinition": {
"version_url":
"http://192.168.56.104/HDP/centos6/HDP-2.5.0.0-1245.xml"
}
}'

avatar

Ok, just making sure that you have also edited the <baseurl> parts of that .xml file itself to point it to your local repository location?

avatar
Contributor

Thank you so much @Jonathan Sneep finally got resolved after editing in VDF file, it started taking repository from local repo server.

Edited these line in VDF xml file

.....
<repo>
<baseurl>http://192.168.56.104/HDP/centos6</baseurl>
<repoid>HDP-2.5</repoid>
<reponame>HDP</reponame>
</repo>
<repo>
<baseurl>http://192.168.56.104/hdpu</baseurl>
<repoid>HDP-UTILS-1.1.0.21</repoid>
<reponame>HDP-UTILS</reponame>
</repo> .....

avatar

That's excellent to hear, glad that it helped. And thank you for confirming that your issue is solved 🙂

avatar
Explorer

Which Operating system you are using?

Which version of HDP and Ambari?