Skip to content

Instantly share code, notes, and snippets.

View ayushgp's full-sized avatar
😁

Ayush Gupta ayushgp

😁
View GitHub Profile
@ayushgp
ayushgp / hasura-migrate.sh
Last active March 11, 2021 02:45
Take Hasura migrations from one server and apply them to another
# Take Hasura migrations from staging and apply them to prod
# Usage: ./migrate.sh "<staging-endpoint>" "<staging-secret>" "<prod-endpoint>" "<prod-secret>" "<migration-name>"
STAGING_ENDPOINT="$1"
STAGING_SECRET="$2"
PROD_ENDPOINT="$3"
PROD_SECRET="$4"
MIGRATION_NAME="$5"
"""
Reads a filegiven as CLI arg, puts a number as prefix on each line
and adds the seperator between the lines.
"""
import sys
file_name = sys.argv[1]
f = open(file_name, 'r', encoding="utf8")
contents = f.readlines()
# Format the namenode
bin/hadoop namenode -format
# Start hadoop related processes
sbin/start-dfs.sh
sbin/start-yarn.sh
# Create input directory and put relavent text file in it
echo "Creating input directory $1 and putting textfile.txt on it."
bin/hadoop fs -mkdir $2
$ jps
3923 Jps
3188 NodeManager
3061 ResourceManager
3531 NameNode
2894 SecondaryNameNode
2687 DataNode
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
$ ssh localhost
$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$ chmod 0600 ~/.ssh/authorized_keys
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>