Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapr v6.2.0 #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ You will learn how to optimize query using MapR-DB Secondary indexes.

**Prerequisites**

* MapR Converged Data Platform 6.0 with Apache Drill or [MapR Container for Developers](https://maprdocs.mapr.com/home/MapRContainerDevelopers/MapRContainerDevelopersOverview.html).
* JDK 8
* HPE Ezmeral Data Fabric 6.2.0 with Apache Drill or [MapR Container for Developers](https://maprdocs.mapr.com/home/MapRContainerDevelopers/MapRContainerDevelopersOverview.html).
* JDK 11
* Maven 3.x

## Setting up MapR Container For Developers

MapR Container For Developers is a docker image that enables you to quickly deploy a MapR environment on your developer machine.
MapR Container For Developers is a docker image that enables you to quickly deploy an HPE Ezmeral Data Fabric environment on your developer machine.

Installation, Setup and further information can be found [**here**](https://maprdocs.mapr.com/home/MapRContainerDevelopers/MapRContainerDevelopersOverview.html).

Expand All @@ -37,7 +37,7 @@ $ tar xvf yelp_dataset.tar

#### 3. Copy the dataset to MapR Cluster

##### 3a. Copy data to the node
##### 3a. Copy data to the node
To do this, we first copy the file (say `yelp_academic_dataset_business.json`) to the cluster node.
```
$ cd dataset
Expand All @@ -56,7 +56,7 @@ where "container-id" can be obtained from the `docker ps` command.

There are two ways to put data into the MapR filesystem, called MapR-XD.

- Simple copy, if [**MapR NFS**](https://maprdocs.mapr.com/home/AdministratorGuide/AccessDataWithNFS.html) is installed and the cluster is mounted at `/mapr`.
- Simple copy, if [**MapR NFS**](https://maprdocs.mapr.com/home/AdministratorGuide/AccessDataWithNFS.html) is installed and the cluster is mounted at `/mapr`.
```
$ cp yelp_academic_dataset_business.json yelp_academic_dataset_review.json yelp_academic_dataset_user.json /mapr/<cluster-name>/tmp/
```
Expand All @@ -68,7 +68,7 @@ hadoop fs -put yelp_academic_dataset_business.json yelp_academic_dataset_review.

#### 4. Import the JSON documents into MapR-DB JSON tables

We will import the Yelp JSON documents into MapR-DB JSON tables using the [mapr importJSON](https://maprdocs.mapr.com/home/ReferenceGuide/mapr_importjson.html?hl=importjson) command. Note, the source file path specified in `mapr importJSON` must be a valid path in the MapR filesystem.
We will import the Yelp JSON documents into MapR-DB JSON tables using the [mapr importJSON](https://maprdocs.mapr.com/home/ReferenceGuide/mapr_importjson.html?hl=importjson) command. Note, the source file path specified in `mapr importJSON` must be a valid path in the MapR filesystem.

```
$ mapr importJSON -idField business_id -src /tmp/yelp_academic_dataset_business.json -dst /apps/business -mapreduce false
Expand Down Expand Up @@ -145,7 +145,7 @@ Let's add the support status "gold" to an existing user, and find all users with
maprdb mapr:> update /apps/user --id l52TR2e4p9K4Z9zezyGKfg --m '{ "$set" : [ {"support" : "gold" } ] }'


maprdb mapr:> find /apps/user --where '{ "$eq" : {"support":"gold"} }' --f _id,name,support
maprdb mapr:> find /apps/user --where '{ "$eq" : {"support":"gold"} }' --f _id,name,support

```

Expand All @@ -168,7 +168,7 @@ maprdb mapr:> find /apps/user --where '{ "$eq" : {"support":"gold"} }' --f _id,n

**7. Using MapR DB Shell Query Syntax**

MapR-DB Shell has a complete JSON syntax to express the query including projection, condition, orderby, limit, skip. For example
MapR-DB Shell has a complete JSON syntax to express the query including projection, condition, orderby, limit, skip. For example

```
maprdb mapr:> find /apps/user --q ' { "$select" : ["_id","name","support"] ,"$where" : {"$eq" : {"support":"gold"}}, "$limit" : 2 }'
Expand Down Expand Up @@ -239,7 +239,7 @@ $ maprcli table index remove -path /apps/business -index idx_stars

**Covering Queries**

In the index you have created in the previous step, we have specific the `-indexedfields` parameter to set the index key with the `stars` values. It is also possible to add some non indexed field to the index using the `-includedfields`.
In the index you have created in the previous step, we have specific the `-indexedfields` parameter to set the index key with the `stars` values. It is also possible to add some non indexed field to the index using the `-includedfields`.

In this case the index includes some other fields that could be used by applications to allow the query to only access the index without having to retrieve any value from the JSON table itself.

Expand Down Expand Up @@ -349,8 +349,3 @@ You can also look at the following examples:

* [Ojai 2.0 Examples](https://github.com/mapr-demos/ojai-2-examples) to learn more about OJAI 2.0 features
* [MapR-DB Change Data Capture](https://github.com/mapr-demos/mapr-db-cdc-sample) to capture database events such as insert, update, delete and react to this events.





46 changes: 35 additions & 11 deletions mapr_devsandbox_container_setup.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
#!/bin/bash

#########################################################################################################
#This script will help to deploy an HPE Ezmeral Data Fabric 6.2.0 environment on your developer machine #
#For more details please refer the documentation #
#########################################################################################################
set -x

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider "set -euxo pipefail "

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMAGE="maprtech/dev-sandbox-container:latest"
INTERFACE="en0"
while [ $# -gt 0 ]
do
case "$1" in
-image) shift; IMAGE=$1;;
-nwiterface) shift; INTERFACE=$1;;
esac
shift
done

IMAGE="${1:-"maprtech/dev-sandbox-container:latest"}"
IP=$(ipconfig getifaddr en0)
which ipconfig

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The which can be inlined into the if to make this a clearer idiom and allow the use of set -euxo pipefail

if [ $? -eq 0 ]; then
IP=$(ipconfig getifaddr $INTERFACE)
else
IP=$(ip addr show $INTERFACE | grep -w inet | awk '{ print $2}' | cut -d "/" -f1)
fi
clusterName="${clusterName:-"maprdemo.mapr.io"}"
hostName=$(echo ${clusterName} | cut -d '.' -f 1)

Expand All @@ -15,9 +32,16 @@ runMaprImage() {

PORTS='-p 9998:9998 -p 8042:8042 -p 8888:8888 -p 8088:8088 -p 9997:9997 -p 10001:10001 -p 8190:8190 -p 8243:8243 -p 2222:22 -p 4040:4040 -p 7221:7221 -p 8090:8090 -p 5660:5660 -p 8443:8443 -p 19888:19888 -p 50060:50060 -p 18080:18080 -p 8032:8032 -p 14000:14000 -p 19890:19890 -p 10000:10000 -p 11443:11443 -p 12000:12000 -p 8081:8081 -p 8002:8002 -p 8080:8080 -p 31010:31010 -p 8044:8044 -p 8047:8047 -p 11000:11000 -p 2049:2049 -p 8188:8188 -p 7077:7077 -p 7222:7222 -p 5181:5181 -p 5661:5661 -p 5692:5692 -p 5724:5724 -p 5756:5756 -p 10020:10020 -p 50000-50050:50000-50050 -p 9001:9001 -p 5693:5693 -p 9002:9002 -p 31011:31011'
#export MAPR_EXTERNAL="0.0.0.0"
export MAPR_EXTERNAL=$(ipconfig getifaddr en0)
#incase non-mac ipconfig command would not be found
which ipconfig
tdunning marked this conversation as resolved.
Show resolved Hide resolved
if [ $? -eq 0 ]; then
export MAPR_EXTERNAL=$(ipconfig getifaddr $INTERFACE)
else
export MAPR_EXTERNAL=$(ip addr show $INTERFACE | grep -w inet | awk '{ print $2}' | cut -d "/" -f1)
fi
echo $MAPR_EXTERNAL

if [ "${IMAGE}" == "maprtech/dev-sandbox-container:latest" ]; then docker pull ${IMAGE}; fi
if [ "${IMAGE}" == "maprtech/dev-sandbox-container:latest" ]; then docker pull ${IMAGE}; fi
docker run -d --privileged -v /tmp/maprdemo/zkdata:/opt/mapr/zkdata -v /tmp/maprdemo/pid:/opt/mapr/pid -v /tmp/maprdemo/logs:/opt/mapr/logs -v /tmp/maprdemo/nfs:/mapr $PORTS -e MAPR_EXTERNAL -e clusterName -e isSecure --hostname ${clusterName} ${IMAGE} > /dev/null 2>&1

# Check if docker container is started wihtout any issue
Expand All @@ -36,8 +60,8 @@ runMaprImage() {
fi
}

docker ps -a | grep dev-sandbox-container > /dev/null 2>&1
if [ $? -ne 0 ]
docker ps -a | grep dev-sandbox-container > /dev/null 2>&1
if [ $? -ne 0 ]
then
STATUS='NOTRUNNING'
else
Expand All @@ -51,19 +75,19 @@ else
CID=$(docker ps -a | grep dev-sandbox-container | awk '{ print $1 }' )
docker rm -f $CID > /dev/null 2>&1
STATUS='NOTRUNNING'
else
else
STATUS='RUNNING'
fi
fi
fi

if [ "$STATUS" == "RUNNING" ]
then
# There is an instance of dev-sandbox-container. Check if it is running or not.
CID=$(docker ps -a | grep dev-sandbox-container | awk '{ print $1 }' )
RUNNING=$(docker inspect --format="{{.State.Running}}" $CID 2> /dev/null)
RUNNING=$(docker inspect --format="{{.State.Running}}" $CID 2> /dev/null)
if [ "$RUNNING" == "true" ]
then
# Container is running there.
# Container is running there.
# Change the IP in /etc/hosts and reconfigure client for the IP Change
# Change the server side settings and restart warden
grep maprdemo /etc/hosts | grep ${IP} > /dev/null 2>&1
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@

<properties>
<log4j.version>1.2.17</log4j.version>
<scala.version>2.11.5</scala.version>
<scala.version>2.11.12</scala.version>

<mapr.library.version>6.1.0-mapr</mapr.library.version>
<drill.version>1.14.0-mapr</drill.version>
<ojai.version>3.0-mapr-1808</ojai.version>
<spark.version>2.3.1-mapr-1808-r1</spark.version>
<mapr.library.version>6.2.0-mapr</mapr.library.version>
<drill.version>1.16.1-mapr</drill.version>
<ojai.version>3.1-mapr</ojai.version>
<spark.version>2.4.5.0-mapr-700</spark.version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
Expand All @@ -53,4 +53,4 @@
<scope>test</scope>
</dependency>
</dependencies>
</project>
</project>