This repository was archived by the owner on Mar 15, 2025. It is now read-only.
mongo에서 mysql로 데이터 옮기는 과정 기록 #1152
kimminkyeu
started this conversation in
메모장
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
mongo에선
조회수
와북마크 횟수
가 각각 다른 컬렉션으로 저장된다.그러나 mysql의
link_stats
는 위 두 정보가 합쳐진 테이블이다.따라서 mysql에서 csv를 load하려면 이를 하나로 합쳐야 한다.
(date, url, 조회수)
+(date, url, 북마크횟수)
=(date, url, 조회수, 북마크횟수)
사전 설치 도구
mongo-databse-tools
홈서버 우분투 버전에 맞춰 로컬에서 deb 파일을 다운받은 뒤
scp로 홈서버에 파일 전송.
이후 홈서버에 deb 설치
1. 지난 한달간의 데이터 csv로 추출
북마크 횟수도 동일하게 하면 된다. (query의 날짜 부분은 맞춰서 수정할 것)
2. 파이썬 스크립트로 조회수, 북마크수 csv를 하나로 병합
3. 합친 csv를 mysql-file 경로에 넣고, mysql에서 데이터 넣기
Beta Was this translation helpful? Give feedback.
All reactions