Statement:
This blog welcome reprint, but please keep the original author information, and please specify the source!
Guo Deqing
Team: Hangzhou OpenStack Team
In the previous article on the installation of Sahara to make a summary, today mainly on how to deploy a Hadoop cluster in the Sahara environment to do a summary, but also put their own deployment of the time filled with the pit summary, to avoid other people in the same pit fall.
1. Uploading Images
Here is the image of the vanilla,: http://docs.openstack.org/developer/sahara/userdoc/vanilla_plugin.html, I choose to be sahara-icehouse-vanilla-1.2.1-centos-6.5.qcow2. Upload the image to glance by using the following command:
Glance image-create--name Sahara-icehouse-vanilla-1.2.1-centos--file. Sahara-icehouse-vanilla-1.2.1-centos-6.5.qcow2--disk-format qcow2--container-format Bare
To register the image to Sahara:
After registering the vanilla image, you need to add two tags: vanilla and Hadoop versions
Sahara Image-add-tag--id a00f66cd-81ee-4bb8-af9a-5cb50e3602a7--tag Vanillasahara image-add-tag--id A00f66cd-81ee-4bb8-af9a-5cb50e3602a7--tag 1.2.1
2. Create a network
Create a route
Neutron router-create router1
Create an external network
Neutron net-create ext_net--router:external=trueneutron subnet-create ext_net--allocation-pool start=172.28.12.10, end=172.28.12.50--gateway 172.28.12.1 172.28.12.0/24--enable_dhcp=false
Create an internal network
Neutron net-create vlan-70 neutron subnet-create vlan-70 70.0.0.0/24
bind inside and outside network to router1
Neutron Router-gateway-set 8dab3833-2616-4713-90c2-ab85f7d1a226 2dd5901d-3292-4edf-9c14-5999b4e6ed0dneutron Router-interface-add 8dab3833-2616-4713-90c2-ab85f7d1a226 a92654b6-09a5-4adc-a301-6a405d5c924d
In addition, in order for the single board and the virtual machine to communicate, need to open a corresponding VLAN sub-interface on the Br-int, and with the same network segment IP:
Vconfig add br-int 2ifconfig br-int.2 70.0.0.5/24
Note: 2 represents the segmentation_id of the network and can be neutron net-show to view the segmentation_id of the corresponding network.
3. Virtual Machine Package:
Nova Flavor-create SAHARA_FLAVOR2 111 1024 11 1
Note: The official image of the vanilla is that the size of the 10g,disk is set to greater than 10G.
4. Create a node Template:
Node-group-templates.json
{ "plugin_name": "Vanilla", "hadoop_version": "1.2.1", "node_processes": [ "Namenode", "Oozie ", " Jobtracker "," datanode ", " Tasktracker ", " Secondarynamenode " ], " name ":" Master ", "Floating_ip_pool": "2dd5901d-3292-4edf-9c14-5999b4e6ed0d", "Auto_security_group": True, "flavor _id ":" 111 "}
To create a command:
Sahara Node-group-template-create--json Node-group-templates.json
5. Create a cluster:
First inject key, otherwise vanilla image because do not know the password can not login.
The first step is to generate the public key
Ssh-keygen-t Rsa-p '
Second step, register the public key via Nova
Nova Keypair-add Sahara--pub-key ~/.ssh/id_rsa.pub
To edit a cluster template:
Cluster-template.json
{ "plugin_name": "Vanilla", "hadoop_version": "1.2.1", "node_groups": [ { "name": "Master", "Count": 1, "node_group_template_id": "56d00dcd-1909-4508-8ea5-65174722fe39" } ], "name": " Cluster-template ", " neutron_management_network ":" 6779575A-9ECA-4BD9-885A-B9389D3B21DC ", " Cluster_ Configs ": { " HDFS ": { " dfs.replication ": 1 } }, " user_keypair_id ":" Sahara ", " default_image_id ":" A00f66cd-81ee-4bb8-af9a-5cb50e3602a7 "}
To create a cluster:
Sahara Cluster-create--json Cluster-template.json
In the deployment of Hadoop cluster, encountered a lot of problems, the following is a general explanation:
Issue 1: When creating the cluster, the following error was reported
Traceback (most recent): File "/usr/lib/python2.7/dist-packages/saharaclient/shell.py", line 762, in main Openstacksaharashell (). Main (Map (Strutils.safe_decode, sys.argv[1:])) File "/usr/lib/python2.7/dist-packages/saharaclient/shell.py", line 698, in main args.func (Self.cs, args) File "/usr/lib/python2.7/dist-packages/saharaclient/api/shell.py", line 327, in Do_cluster_create _show_cluster (Cs.clusters.create (**template)) File "/usr/lib/python2.7/dist-packages/saharaclient/api/clusters.py", line +, in Create Node_groups=node_ Groups) File "/usr/lib/python2.7/dist-packages/saharaclient/api/clusters.py", line +, in _assert_variables var_name) Apiexception:none
By means of the method _assert_variables this method out of the break point, found that because the cluster template, not set default_image_id This parameter is caused, but the official website of the rest of the example does not have this parameter.
Issue 2: Multiple node targets were set at the beginning, and multiple Namenode, Jobtracker, and Oozie were deployed in multiple node targets, causing the following error to be reported:
Error:hadoop cluster should contain 1 Namenode component (s). Actual namenode count is 2error:hadoop cluster should contain 0 or 1 Jobtracker component (s). Actual jobtracker count is 2error:hadoop cluster should contain 0 or 1 Oozie component (s). Actual Oozie Count is 2
Therefore, in a Hadoop cluster, Namenode, Jobtracker, and Oozie can have at most one.
Problem 3:FLOATINGIP Pool not found
At first it was simply creating a network, causing errors in configuring the floating IP, and creating the OK using the method of creating the network in front of me.
Issue 4: Virtual machine Get metadata failed
In order for the virtual machine to get metadata, the configuration files for the NOVA-API and neutron metadata are required for configuration:
The following parameters need to be configured in the NOVA-API configuration:
Enabled_apis=ec2,osapi_compute,metadatametadata_workers = 1service_neutron_metadata_proxy = Truemetadata_listen = 192.168.206.190metadata_port = 8775
Neutron metadata configuration file Metadata_agent.ini, you need to configure:
Nova_metadata_ip = 192.168.206.190nova_metadata_port = 8775nova_metadata_protocol = Httpnova_client_cert = Openstacknova_client_priv_key = OpenStack
Resources
Http://docs.openstack.org/developer/sahara/devref/quickstart.html
Http://docs.openstack.org/developer/sahara/restapi/rest_api_v1.0.html
Http://docs.openstack.org/developer/sahara/userdoc/vanilla_plugin.html#cluster-validation
Http://www.server110.com/openstack/201402/6817.html
Deploying Hadoop clusters through Sahara