Sunday, April 24, 2016

ERROR : brew could not symlink, /usr/local/sbin is not writable.

If you encounter the following error while installing with brew, it could probably be due to lack of proper permissions. 

Error that encountered during installation of hadoop on MAC:
=======================================================================
$ brew install hadoop
==> Downloading https://www.apache.org/dyn/closer.cgi?path=hadoop/common/hadoop-2.7.2/hadoop-2.7.2.tar.gz
==> Best Mirror http://mirror.symnds.com/software/Apache/hadoop/common/hadoop-2.7.2/hadoop-2.7.2.tar.gz
######################################################################## 100.0%

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink sbin/distribute-exclude.sh
/usr/local/sbin is not writable.

You can try again using:
  brew link hadoop
==> Caveats
In Hadoop's config file:
  /usr/local/Cellar/hadoop/2.7.2/libexec/etc/hadoop/hadoop-env.sh,
  /usr/local/Cellar/hadoop/2.7.2/libexec/etc/hadoop/mapred-env.sh and
  /usr/local/Cellar/hadoop/2.7.2/libexec/etc/hadoop/yarn-env.sh
$JAVA_HOME has been set to be the output of:
  /usr/libexec/java_home
==> Summary
 /usr/local/Cellar/hadoop/2.7.2: 6,304 files, 309.8M, built in 13 minutes 35 seconds
======================================================================

Run the following commands to grant the privileges 

$ sudo chown -R $(whoami) /usr/local
$ sudo chown -R $(whoami) /Library/Caches/Homebrew

Once the privileges are granted, now hadoop has to be just linked since it is already installed.

$ brew link hadoop

Linking /usr/local/Cellar/hadoop/2.7.2... 27 symlinks created

Friday, April 15, 2016

MongoDB Questions and Answers - Operators



1. $cmp comparison operator returns ______ as output.
a. Boolean
b. Number


2. All comparison expressions returns boolean except for $cmp.
a. True
b. False


3. Number of arguments required for the comparison aggregation operators
a. 1
b. 2
c. 3
d. 4


4. Comparison operators compare _____
a. Only value
b. Only type
c. Both value and type
d. None of the above


5. Choose the comparison operators below. Select all that apply.
a. $ne
b. $cmp
c. $in
d. $all


6. Arithmetic aggregation operators perform mathematical operators only on numbers.
a. True
b. False


7. String expressions, with the exception of _____ have a well defined behavior for strings of ASCII characters.
a. $strcasecmp
b. $toUpper
c. $toLower
d. $concat


8. Aggregation operator to access the text search metadata is
a. $text
b. $meta
c. $let
d. $slice


9. The following command returns the milli seconds portion of a date
a. $millis
b. $milliseconds
c. $millisecond
d. $milli


10. Choose the ternary operator.
a. $ifNull
b. $multiply
c. $cond
d. $sum


Answers
--------------

1. b
2. a
3. b
4. c
5. a,b
6. b
7. d
8. b
9. c
10. c


Tuesday, April 12, 2016

MongoDB Sample Questions and Answers - Packages


1. Mongodump doesn't dump the contents of the following database.
a) system
b) test
c) local
d) All of the above

2.___________ manipulate files stored in your MongoDB instance in GridFS.
a) mongorestore
b) mongofiles
c) mongosupport
d) None of the mentioned


3. __________ is a command-line utility to import content from a JSON, CSV, or TSV.
a) mongorestore
b) mongofiles
c) mongosupport
d) mongoimport


4. Which of the following is used for creating binary export of the contents in MongoDB?
a) mongodump
b) mongofiles
c) mongosupport
d) mongoimport


5. Which command line utility works on GridFS?
a) mongodump
b) mongofiles
c) mongosupport
d) mongoimport


6. _____________ is a native OS-X-application for MongoDB management.
a) Apricot
b) MongoHub
c) Mongo
d) 3T MongoChe

7.___________ is a routing service for MongoDB shard configurations that processes queries from the application layer.
a) mongod
b) mongos
c) mongo
d) None of the mentioned

8.___________ is the primary daemon process for the MongoDB system.
a) mongos
b) mongod
c) logpath
d) syspathlog


9. Mongo Shell is an interactive ______ interface.
a) C++
b) Python
c) Java Script
d) Java


10. _____ provides statistics at per collection level.
a) mongostat
b) mongotop
c) mongofiles
d) mongoperf


11. ________ provides overall status of currently running mongod and mongos instances.
a) mongostat
b) mongotop
c) mongofiles
d) mongoperf


Answers
-------------
1. c
2. b
3. d
4. a
5. b
6. b
7. b
8. b
9. c
10. b
11. a




Wednesday, April 6, 2016

MongoDB Sample Questions and Answers - Indexes

Here are some of the sample questions and answers on Performance in MongoDB.

1. How many indexes are allowed per collection in MongoDB?
a. 31
b. 32
c. 64
d. 60


2. Below operators are bad candidates for indexes? Choose all the possible answers.
a. $ne
b. $nin
c. $eq
d. $not


3. If an index is created on existing collection, it doesn't validate the already existing data.
a. True
b. False


4. Text indexes are sparse by default.
a. True
b. False


5.  system.profile collection is a Capped collection.
a. True
b. False


6. Text indexes don't support compound indexes. They are always single field indexes.
a. True
b. False


7. Can we build multiple background indexes in parallel?
a. Yes
b. No


8. Can we have multiple foreground indexes building in parallel?
a. Yes
b. No


9. Point out the wrong statement
a. Query selectivity refers to how well the query predicate excludes or filters out documents in a collection
b. Query selectivity can determine whether or not queries can use indexes effectively or even use indexes at all
c. More selective queries match a larger percentage of documents
d. All of the mentioned


10. Point out the wrong statement
a. Multikey indexes are always single field indexes.
b. TTL indexes are always single field indexes.
c. Hash indexes doesn't support multi key indexes.
d. Multikey indexes can't be used for sharding.

Answers
-----------------
1. c
2. a,b,d
3. b
4. a
5. a
6. b
7. a
8. b
9. c
10. a




Amazon Athena: Key highlights on Amazon Athena

Amazon Athena is a serverless interactive query service that is used to analyze data in Amazon S3 using standard SQL. Amazon Athena app...