Screen Shot 2022-07-03 at 3.38.39 PM.png

  1. 영화 평점 데이터 → 사람별로 나눔

  2. 실제로는 한줄로 되어있으니 이걸 UserID로 묶는 코드를 파이썬으로 작성할 예정

    1. 파이썬 → REST service(HTTP request) → HBase → HDFS
  3. port fowarding → 8000 되어있슴

  4. ambari에서 Hbase시작

    1. 인터넷 문제인지 뭔지 오랜만에 켜서인지 다 꺼져있어서 다시 켜보았는데 31분이나 걸림

    Untitled

Untitled

  1. REST 서버 시작
/usr/hdp/current/hbase-master/bin/hbase-daemon.sh start rest -p 8000 -infoport 8001

Untitled

  1. HBase로 업로드
from starbase import Connection

c = Connection('127.0.0.1', '8000')

ratings = c.table('ratings')

if ratings.exists():
	print('dropping existing ratings table')
	ratings.drop()

ratings.create('rating')

ratingFile = open(PATH_TO_u.data, 'r')

batch = ratings.batch()

for line in ratingsFile:
	(userID, movieID, rating, timestamp) = line.split()
	batch.update(userID, {'rating': {movieID: rating}})

batch.commit(finalize=True)

  1. REST 서버 종료
/usr/hdp/current/hbase-master/bin/hbase-daemon.sh stop rest