#!/bin/bash
# Declaring Variables
table0="employee"
path=$(pwd);
# Creating a Employee table in HBase
echo "exists '$table0'" | hbase shell > log
cat log | grep "Table employee does exist"
if [ $? = 0 ];then
echo "************ table is already exists **********"
# Either you can use truncate or disable & drop options
echo "disable '$table0'" | hbase shell
echo "drop '$table0'" | hbase shell
# echo "truncate '$table0'" | hbase shell
echo "create '$table0','count'" | hbase shell
# Either you can use shell commands here or call another .sh file.. here i have used another file option
cd $path/depends
chmod +x hbase-script.sh
./hbase-script.sh | hbase shell
else
echo "*********** need to create a table **********"
echo "create '$table0','count'" | hbase shell
cd $path/depends
chmod +x hbase-script.sh
./hbase-script.sh | hbase shell
fi
# Creating, copying and populating the table0 table
echo ${HADOOP_HOME}
username="$USER"
echo $(hadoop fs -copyFromLocal $path/depends/table0 /user/$username/hbasetable/table0)
echo $(hbase org.apache.hadoop.hbase.mapreduce.Import table0 /user/$username/hbasetable/table0)
echo $(hadoop fs -rmr /user/$username/hbasetable)
exit
# Declaring Variables
table0="employee"
path=$(pwd);
# Creating a Employee table in HBase
echo "exists '$table0'" | hbase shell > log
cat log | grep "Table employee does exist"
if [ $? = 0 ];then
echo "************ table is already exists **********"
# Either you can use truncate or disable & drop options
echo "disable '$table0'" | hbase shell
echo "drop '$table0'" | hbase shell
# echo "truncate '$table0'" | hbase shell
echo "create '$table0','count'" | hbase shell
# Either you can use shell commands here or call another .sh file.. here i have used another file option
cd $path/depends
chmod +x hbase-script.sh
./hbase-script.sh | hbase shell
else
echo "*********** need to create a table **********"
echo "create '$table0','count'" | hbase shell
cd $path/depends
chmod +x hbase-script.sh
./hbase-script.sh | hbase shell
fi
# Creating, copying and populating the table0 table
echo ${HADOOP_HOME}
username="$USER"
echo $(hadoop fs -copyFromLocal $path/depends/table0 /user/$username/hbasetable/table0)
echo $(hbase org.apache.hadoop.hbase.mapreduce.Import table0 /user/$username/hbasetable/table0)
echo $(hadoop fs -rmr /user/$username/hbasetable)
exit
Hi,
ReplyDeleteIs there a way to execute the hbase commands like we do for hive. for eg. in hive we do
hive -e "select a,b,c from abc;"
Something similar like this. thanks for the help
OnlineITGuru is the top services provider for receiving knowledge on Ruby and they are
ReplyDeletefamiliar with internet and websites programming like Big data hadoop online Training Bangalore
bitlis
ReplyDeletekastamonu
çorum
van
sakarya
2P7MFT
düzce
ReplyDeletesakarya
tunceli
van
bayburt
İMHR
görüntülü.show
ReplyDeletewhatsapp ücretli show
H3PX6L
Çorum Lojistik
ReplyDeleteKaraman Lojistik
Gümüşhane Lojistik
Denizli Lojistik
Artvin Lojistik
MCWLU
2FF1E
ReplyDeleteMamak Parke Ustası
Etlik Parke Ustası
Nevşehir Şehirler Arası Nakliyat
Malatya Şehir İçi Nakliyat
Konya Evden Eve Nakliyat
Çerkezköy Parke Ustası
Isparta Şehir İçi Nakliyat
Batıkent Parke Ustası
Kripto Para Nedir
63AC3
ReplyDeleteBayburt Şehirler Arası Nakliyat
Ünye Halı Yıkama
Urfa Şehir İçi Nakliyat
Gümüşhane Lojistik
Bitlis Parça Eşya Taşıma
Ünye Fayans Ustası
İstanbul Şehir İçi Nakliyat
Chat Gpt Coin Hangi Borsada
Mardin Şehirler Arası Nakliyat
3DE3D
ReplyDeleteKonya Parça Eşya Taşıma
Bartın Lojistik
Trabzon Şehirler Arası Nakliyat
Adana Lojistik
Çerkezköy Mutfak Dolabı
Aptos Coin Hangi Borsada
Manisa Parça Eşya Taşıma
Gümüşhane Şehir İçi Nakliyat
Isparta Lojistik
1B7AE
ReplyDeleteçankırı bedava sohbet chat odaları
ankara ücretsiz sohbet uygulaması
karabük nanytoo sohbet
aydın sohbet muhabbet
kırşehir rastgele sohbet
bedava sohbet
tekirdağ telefonda kızlarla sohbet
sohbet chat
aksaray telefonda kızlarla sohbet
2519F
ReplyDeleteBinance Kaldıraçlı İşlem Nasıl Yapılır
Threads Yeniden Paylaş Hilesi
Lunc Coin Hangi Borsada
Twitch İzlenme Satın Al
Aptos Coin Hangi Borsada
Binance Sahibi Kim
Binance Referans Kodu
Periscope Takipçi Satın Al
Satoshi Coin Hangi Borsada
26197
ReplyDeletePinterest Takipçi Hilesi
Binance Nasıl Oynanır
Btcst Coin Hangi Borsada
Görüntülü Sohbet
Aion Coin Hangi Borsada
Chat Gpt Coin Hangi Borsada
Bitcoin Nasıl Çıkarılır
Trovo Takipçi Hilesi
Threads İzlenme Satın Al