Directory
- On-Line modification
- SOURCE structure
- Technical points
- Building a compilation environment
- Installing Samba
- Install the compilation environment
- Start compiling
- 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.
- Installing Samba
grep samba# Installation command if not installed yum Install Samba
- Restarting the SMB service
Service SMB Restart
- Creating a Samba user on Linux
Useradd Samba
- To create an SMB user, this user must be already established on Linux, enter the password, and complete.
Smbpasswd-a Samba
- Shutting down the firewall
- Make sure the setlinux is off
0
- 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
- Installing the JDK
Yum Install java-1.7. 0-openjdk java-1.7. 0-openjdk-/usr/lib/jvm/java-1.7. 0-openjdk
- Installing MAVEN
Yum Install maven
Mvn-v #验证安装情况
- Install Python
Yum Install -V #验证安装情况
- Installing Rpm-build
grep rpm-yuminstall rpm-build
- Installing g++
grep gcc-c++ #安装 yuminstallgcc-c++
- Install Nodejs
- 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
- to download to a directory using wget
wget http:// nodejs.org/dist/latest-v7.x/node-v7.3.0-linux-x64.tar.gz
- extract
tar zxvf node-v7.-linux-x64. tar . GZ
- 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
- View installation
node-v
Npm-v
- Installing brunch
Install -g brunchbrunch #检测
- Install Git (you can skip this step if the code is local)
Yum Install --version #检测
Download Ambari code using git
3. Start compiling
- CD to Ambari's home directory
- Give Ambari a version number.
MVN versions:set-dnewversion=2.4. 2.0 #后面这是four -bit version number, consistent with the Ambari version
- 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.
- Install Lodash. CD to Ambari-web/node-modules directory
Install Lodash--savecd lodashnpm install --save sass-brunch
- 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.
- Make sure node. js is installed
- In the Global installation brunch
Install -G brunch
- 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
- 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
- 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
- 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