Saturday 30 April 2016

SAXParseException hadoop-2.7.2

Caused by: org.xml.sax.SAXParseException; systemId: file:/usr/local/hadoop-2.7.2/etc/hadoop/core-site.xml; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog

solution :

check xml configuration of the file.
cause due not proper closing of tag

hadoop-env.sh missing in hadoop 2.7

hadoop-env.sh missing in hadoop 2.7

earlier location :

/conf/hadoop-env.sh

location is changed to

/etc/hadoop/hadoop-env.sh



install grunt server and start the grunt server


install grunt server and start the grunt server

1) install grunt server.
cmd : npm install -g grunt-cli

2) start grunt server.
note : after creation of yeoman project go to directory
cmd : grunt server

Friday 29 April 2016

angularjs project scaffolding using yeoman

create a project using yo
prerequisite
a) install npm on your box.

1) install yeoman online using npm command.
cmd : npm install -g yo
ref : github (https://github.com/yeoman/yo)
2) create the project scaffolding using yo command.
note : create a project folder "voiceapp" and move to the directory.
cmd : yo  or (yo angular)
3) We get set of options, choose option based on requirement. here we choose angular.
There are some experimental feature like gulp/saas, based on requirement choose yes or no.
a) angular
b) webapp
..
4) include bootstrap choose yes option.
>( ) angular-animate.js
 ( ) angular-aria.js
 ( ) angular-cookies.js
 (*) angular-resource.js
 ( ) angular-messages.js
 (*) angular-route.js
 (*) angular-sanitize.js
 ( ) angular-touch.js

choose the following angular(resource/route/sanitize).

5) skip if there any option when installation.

angular.js:13550 Error: [ng:areq] Argument 'MynameCtrl' is not a function, got undefined

angular.js:13550 Error: [ng:areq] Argument 'MynameCtrl' is not a function, got undefined

solution :

include controller.js in index file or the required reference file where you are calling

Thursday 28 April 2016

Genrating project scaffolding for angular js using Yeoman.

step 1.
a) install nodejs window/linux machine or based on the os you have.
ref : nodejs
step 2.
a) install Yeoman ,grunt,bower.
ref : Yeoman
cmd :  install yo.
b) From the given choose angular js and click next.

note :
a) Yeoman : for generating project scaffolding.
b) bower : package manager.
c) grunt : to perform repetitive task, minification,unit testing.



Wednesday 27 April 2016

how to Enable EPEL Repository for RHEL linux.

how to Enable EPEL Repository for RHEL linux.
EPEL (Extra Packages for Enterprise Linux)
ref : linux 

Tuesday 26 April 2016

Access denied for user 'ec2-user'@'localhost' (using password: NO)

Access denied for user 'ec2-user'@'localhost' (using password: NO)

ref : ()

a) grep 'temporary password' /var/log/mysqld.log

login with temp password.

b) mysql -u root -p
password : 'temporary password'

(or)

mysql> UPDATE mysql.user SET Password=PASSWORD('your_new_password') WHERE User='root';

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> SET PASSWORD = PASSWORD('your_new_password');

Query OK, 0 rows affected, 1 warning (0.01 sec)

follow step - b.

ref : stackoverflow for a
stackoverflow : for b.



install/install mysql in rhel linux

install/install mysql in rhel linux
ref :
https://dev.mysql.com/doc/mysql-repo-excerpt/5.6/en/linux-installation-yum-repo.html
1) get the URL for the mysql rpm
sudo wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

2) sudo yum install mysql57-community-release-el7-8.noarch.rpm


3) now install the server.
cmd : sudo yum install mysql-community-server

4) sudo service mysqld start

5) remove the mysql server.
cmd : yum remove mysql mysql-server

install tomcat on linux


install tomcat

go to /temp dir
sudo wget http://redrockdigimark.com/apachemirror/tomcat/tomcat-7/v7.0.69/bin/apache-tomcat-7.0.69.tar.gz

2) unzip file
tar xzf apache-tomcat-7.0.69.tar.gz

3) move the folder to tomcat7

mv apache-tomcat-7.0.69 /usr/local/tomcat7

4) start the tomcat server.
go to the ./bin/startup.sh

output :
cmd : ./bin/startup.sh
Using CATALINA_BASE:   /usr/local/tomcat7/apache-tomcat-7.0.69
Using CATALINA_HOME:   /usr/local/tomcat7/apache-tomcat-7.0.69
Using CATALINA_TMPDIR: /usr/local/tomcat7/apache-tomcat-7.0.69/temp
Using JRE_HOME:        /usr/java/jdk1.8.0_45/jre
Using CLASSPATH:       /usr/local/tomcat7/apache-tomcat-7.0.69/bin/bootstrap.jar:/usr/local/tomcat7/apache-tomcat-7.0.69/bin/tomcat-juli.jar
Tomcat started.

5) set up user account in conf/tomcat-users.xml.

<!-- user manager can access only manager section -->
<role rolename="manager-gui" />
<user username="manager" password="abc" roles="manager-gui" />

<!-- user admin can access manager and admin section both -->
<role rolename="admin-gui" />
<user username="admin" password="def" roles="manager-gui,admin-gui" />


6) change the port to 8082

go to conf/server.xml  and change the default port from 8080 t0 8082

 <Connector port="8082" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

7) connect to tomcat :
http://xx.xxx.xxx.xxx:8082/manager/html

Monday 25 April 2016

set the java path permanently in linux

c) set the java path

export JAVA_HOME=/usr/java/jdk1.8.0_45

d) Setup JRE_HOME Variable

export JRE_HOME=/usr/java/jdk1.8.0_45/jre

e) Setup PATH Variable

export PATH=$PATH:/usr/java/jdk1.8.0_45/bin:/usr/java/jdk1.8.0_45/jre/bin

environment variable :

/etc/environment

to set the variable permanently.

go to directory
/etc
open profile.
cmd : vi profile

set all the variable at the bottom of the pofile.
check from new command window weather you are able to see the path.

find java path in linux.

find java path in linux.

a) which java
output : /usr/bin/java.

b) readlink -f $(which java)
output : /usr/java/jdk1.8.0_45/jre/bin/java

can we redownload the .pem file, for a key-value pair in aws ec2 instance.

Q) can we redownload the .pem file, for a key-value pair in aws ec2 instance.
A) no. it can be downloaded only once. you  have to create new key-value pair.
ref : stackoverflow 

know which is the user loggedin.

know which is the user loggedin.

syntax : who [OPTION]... [ FILE | ARG1 ARG2 ]

cmd  : who
ref : ibm

intsall nodejs in rhel linux .

intsall nodejs in rhel linux .
command :
1) sudo rpm -ivh epel-release-7-6.noarch.rpm
2) sudo yum install npm
3) node --version

recover terminated instance ec2

Recover terminated instance ec2

1) login to the aws account.
2) go to the instance.
3) go to the elastic block store
a) create a volume.
b) create a snapshot.


REF : aws


Sunday 24 April 2016

How to set up mongodb

How to set up mongodb
download the mongodb sodtware from the site, based on the OS.
Currently OS used is windows7 - 64bit


1)
Install mongo, by click on exe file

Open the command prompt
Now go to installation directory and start the mongo server by providing the db path and port number.

ex : mongod -dbpath C:\mongodb\data\db -port 13627

> go to the bin directory and check the logs file once the server is started

C:\mongodb\log

output :
[websvr] admin web console waiting for connections on port 28017


2)
Now start the mongo client or connect to mongodb

C:\mongodb\bin\mongo

output :

MongoDB shell version: 2.4.5
connecting to: test

> go to bin directory and check the log when we start the mongodb
C:\mongodb\log

output :
connection accepted from 127.0.0.1:50142 #2 (1 connection now open)


2.1 ) For help content

command : db.help()

2.2) to see the database

command  : show dbs

2.3) create collections/db in mongo

command :  use collectionName (if not exixting it will create)


2.4)  To list all collections:

command : show collections


3) Create Collection/table in mongo

ex :  db.createCollection("FirstCollection")
{ "ok" : 1 }

Check in logs file :

[FileAllocator] done allocating datafile \data\db\yourDB.1, size: 128MB,  took 0.249 secs


3.1) see the collection/table created in db
command : show collections
output :
FirstCollection
system.indexes

3.2) for inserting the data
command :
db.FirstCollection.insert({item:"shoes",id:"10"})
output:
{ "_id" : ObjectId("56fd238aecaeb8e797ff4a09"), "item" : "shoes", "id" : "10" }

3.3)
for select the data.
ex :
db.FirstCollection.find()
db.FirstCollection.find()



3.4)fetching specifics record

ex : db.FirstCollection.find({item:"shoes"})
output :
{ "_id" : ObjectId("56fd238aecaeb8e797ff4a09"), "item" : "shoes", "id" : "10" }


3.5) update the record

ex : > db.FirstCollection.update({item:"shoes"},{$set:{item:"11"}})

3.6) update the record if it not exist :

ex : db.FirstCollection.update({item:"shirt"},{id:"22"},{upsert:"true"})

3.7) delete a record

ex : db.FirstCollection.remove({item:"15"})