Two-time development based on ambari2.4.0

Source: Internet
Author: User

Directory

    1. On-Line modification
    2. SOURCE structure
    3. Technical points
    4. Building a compilation environment
      1. Installing Samba
      2. Install the compilation environment
      3. Start compiling
    5. Web content Modification

Wiki:https://cwiki.apache.org/confluence/display/ambari/ambari

On-Line modification

The GUI part of Ambari is divided into two pieces:

①ambari-admin page

② Cluster Management page (Ambari-web)

Judging from the results of the release

Directory/var/lib/ambari-server/resources/views/work/There are a lot of components below the view, each directory is a child site

Corresponding access address: Http://[ambari-server host]:8080/views/[viewname]/[version]/[instance_name]/

ViewName is the component name

Version is the content in curly braces.

Instance_name is the name value of the View.xml auto-instance under the corresponding directory

such as http://192.168.0.35:8080/views/TEZ/0.7.0.2.5.3.0-136/TEZ_CLUSTER_INSTANCE/

And the admin part we're looking for is admin_view. The contents are as follows

Cluster Management section in the/usr/lib/ambari-server/web

If you just want to simply change a few words, replace a few pictures of the words directly to change the contents on it.

But all are merged compressed, direct modification is inconvenient (the main code is compressed into a app.js, 7m+).

SOURCE structure

To facilitate the understanding of the tree, an online brain map was used to show it.

View full

Technical points

Building a compilation environment 1. Installing Samba

Because of the need to use Nodejs, Python and other compilation environment, and nodejs some library files need C + +, Ruby, Python and other languages to compile, processing on Windows is more complex, so choose to build the Linux build environment, and use the Samba protocol to share files from Linux, run tests on Linux, and code modifications under Windows.

    1. Installing Samba
      grep samba# Installation  command if not installed yum Install Samba

    2. Restarting the SMB service
      Service SMB Restart

    3. Creating a Samba user on Linux
      Useradd Samba

    4. To create an SMB user, this user must be already established on Linux, enter the password, and complete.
      Smbpasswd-a Samba

    5. Shutting down the firewall
    6. Make sure the setlinux is off
      0

    7. To modify/etc/samba/smb.conf, add the folder you want to share at the end:
      [Samba home]     =/home/Samba    = Yes    = no

You can now access the shared directory on Windows and enter \\<samba_ip> on File Explorer. Note that there are two backslashes in front of the IP

2. Install the compilation environment
  1. Installing the JDK
    Yum Install java-1.7. 0-openjdk java-1.7. 0-openjdk-/usr/lib/jvm/java-1.7. 0-openjdk

  2. Installing MAVEN
    Yum Install maven
    Mvn-v #验证安装情况

  3. Install Python
    Yum Install  -V #验证安装情况

  4. Installing Rpm-build
    grep rpm-yuminstall rpm-build

  5. Installing g++
    grep gcc-c++ #安装 yuminstallgcc-c++

  6. Install Nodejs
    1. to select a Nodejs version first, and note that if Python is above 2.6, Nodejs must be a version 4.0 or more address. I used the 7.3.0
    2. to download to a directory using wget
       wget  http:// nodejs.org/dist/latest-v7.x/node-v7.3.0-linux-x64.tar.gz  
    3. extract
       tar  zxvf node-v7.-linux-x64. tar . GZ 
    4. setting environment variables in /etc/profile  
       ......export node_home  = /opt/ node-v7.3.0-linux-x64   export PATH  = $PATH: $NODE _home/bin 

        Make it effective

       source/etc/profile 
    5. View installation
       node-v 
      Npm-v
  7. Installing brunch
    Install -g brunchbrunch  #检测

  8. Install Git (you can skip this step if the code is local)
    Yum Install  --version #检测

    Download Ambari code using git

3. Start compiling
  1. CD to Ambari's home directory
  2. Give Ambari a version number.
    MVN versions:set-dnewversion=2.4. 2.0  #后面这是four -bit version number, consistent with the Ambari version

  3. compile Ambari
     mvn-b-E clean install  package Rpm:rpm-dnewversion=2.4 . 2.0 -dskiptests-dpython.ver= python >= 2.6   -preplaceurl #四位版本号 consistent with the previous step 

    This step will not Disconnected download dependent files, time may be longer   project need to use nodejs in NPM management dependencies, some dependencies are particularly difficult to download, downloaded and stored in ambari-web/node_modules, at the next compile time can ambari-web/node_modules backup, the next time the compilation, The project can be mvn clean Delete, and then the backup node_modules copied into the project, re-execute MVN install operation, can save a lot of time.

  4. Install Lodash. CD to Ambari-web/node-modules directory
    Install Lodash--savecd lodashnpm  install --save sass-brunch

  5. CD to the Ambari-web directory to execute the command
    Brunch Watch--server

    If you open the URL http://<ambari-webserver ip>:3333 can see the results.

Content to be consolidated

Http://stackoverflow.com/questions/29468404/gyp-warn-eacces-user-root-does-not-have-permission-to-access-the-dev-dir

Interrupted 1. About Brunch

Brunch Automated Packaging Compression compilation tool. The front-end of the engineering of the weapon.

Changes to the source code can quickly react to compression results.

Frustration, please poke.

  1. Make sure node. js is installed
  2. In the Global installation brunch
    Install -G brunch

  3. Create a project in the current directory Hellobrunch
    Brunch New Hellobrunch-s ES6

    After successful creation, the current directory creates a folder Hellobrunch, generates some structure and related files, and installs all dependent packages (node_modules) via NPM download

  4. CD to the project directory that you just created (that is, hellobrunch) to compile. The results of the compiled compression merge appear in the public folder
    Brunch Build

    which
    Files in the assets are copied directly to public
    Brunch-config stores the rules for compression merge compilation
    Package.json storage is a dependency package information
    Public/app.js and Public/app.css are results of consolidation based on consolidation rules
    *.map is the code mapping information for debugging

  5. Now a simple webapp is formed and the next step is to start. If the source changes after startup, the contents of the public will automatically follow the changes.
    Brunch Watch--server

    You can see that the port for the service is 3333, so we can view it via http://<ip>:3333 on the browser

  6. Installing plugins such as jquery
    Install --save jquery

    Application: (At the end of App/initialize.js, add the following code.) This code snippet has been found in public/app.js after saving)

    var $ = require ('jquery'); Console.log ('Tasty Brunch, just trying to Use jquery! ', $ ('body'));

Interrupted 2:ember.js

Front-end frame similar to Angularjs

Frustration, please poke.

Interrupted 3:NPM

Nodejs Package Manager

NPM install-g <package-name> #全局模式安装模块

NPM Install <package-name> #在当前所在项目安装模块 (so go to project directory)

NPM Install <package-name>@<version> #安装指定版本的模块 (default to get the latest version if not specified)

NPM install <package-name>@ ">=v1 <v2" #指定版本范围

NPM Uninstall [-G] <package name> #卸载本地 [Global] Module

NPM Update [-G] <package name> #更新本地 [Global] Module

var Modulea = require (' <package-name> '); #使用模块

If there is a problem with [Cannot find module ' xxxx '] reference http://stackoverflow.com/questions/10776405/ Npm-cant-install-appjs-error-cannot-find-module-graceful-fs

Web content Modification

We first implement modifications based on the results of the publication.

Ambari-admin is developed using ANGULARJS, and template engine technology is also using simple HTML fragments. Direct modification can

Reference:

    • Ambari Series
    • Official Wiki

Two-time development based on ambari2.4.0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.