728x90

한 번 설치해서 잘 돌아가는 시스템을 업그레이드 하는 것은 참 귀찮은 일입니다. 하지만 새로운 버전에서만 쓸 수 있는 기능이 생겼고 이를 사용해야 하는 경우엔 어쩔수 없이 업그레이드를 선택하게 되죠. 여기저기에서 마구 설치해서 사용하고 있는 grafana 역시 새로운 버전이 종종 등장하고 있어 가끔씩 업데이트 해줘야 새로운 기능을 활용할 수 있습니다. 

오래전에 설치해 사용하던 grafana 를 업그레이드하려다 보니 혹시나~ 하는 생각이 들어서 방법을 정리해 봅니다. 쓰시는 분이 많지 않아 업그레이드의 부담은 없었지만, grafana 공식 페이지의 문서가 보기가 좀 불편한 점들도 있어서 추후 작업을 위해 이력을 남기는 차원입니다 ㅎㅎ


설치된 grafana 버전 확인하기

꼭 필요한 과정은 아니지만 설치된 grafana 패키지의 버전을 확인해보겠습니다. 권한에 따라 sudo 명령을 곁들여 주시면 맛이 더욱 훌륭합니다. 6.6.1 버전이니 오래된 유물급까지는 아니지만 꽤 오래된 버전입니다. 제 경우 yum 으로 설치하긴 했지만, grafana 의 공식 repo 를 쓰지 않고 grafana 웹 페이지에서 rpm 을 다운로드 받아 yum 으로 localinstall 했습니다. 

$ sudo yum list grafana
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Installed Packages
grafana.x86_64                      6.6.1-1                        installed

 

grafana.db 파일 백업하기

grafana 의 설정을 sqlite (기본 값) 로 해두었다면 grafana.db 파일을 백업해야 합니다. mysql 등의 다른 DB 를 사용했다면 해당 DB 의 데이터베이스나 테이블 내용을 백업해야 합니다. sqlite 는 파일 기반 DB 라 백업도 간편하죠. 패키지를 설치했을 경우 경로는 아래와 같으며, 파일을 그대로 다른 경로에 옮겨두면 나중에 복원시 사용할 수 있습니다. 

$ mkdir backup
$ cp /var/lib/grafana/grafana.db ./backup/

 

새로운 버전의 rpm 다운로드 받기

기억이 맞다면 repo 를 등록해서 yum 으로 패키지 설치를 하지 못했었는데... 일단 현재는 가능한 것 같습니다. repo 를 등재하여 별도 다운로드 없이 패키지를 설치하셔도 되고, 저처럼 rpm 을 받아 설치해도 무방합니다. 

# RPM 다운로드 경로 : grafana.com/grafana/download

 

Download Grafana

Overview of how to download and install different versions of Grafana on different operating systems.

grafana.com

# yum repo 등록후 설치 가이드 (CentOS 기준) : grafana.com/docs/grafana/latest/installation/rpm/

 

Install on RPM-based Linux

› Installation › Install on RPM-based Linux Install on RPM-based Linux (CentOS, Fedora, OpenSuse, Red Hat) This page explains how to install Grafana dependencies, download and install Grafana, get the service up and running on your RPM-based Linux syst

grafana.com

$ wget https://dl.grafana.com/oss/release/grafana-7.3.7-1.x86_64.rpm
--2021-01-20 16:29:54--  https://dl.grafana.com/oss/release/grafana-7.3.7-1.x86_64.rpm
Resolving dl.grafana.com (dl.grafana.com)... 151.101.198.217, 2a04:4e42:2e::729
Connecting to dl.grafana.com (dl.grafana.com)|151.101.198.217|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 53729497 (51M) [application/x-redhat-package-manager]
Saving to: ‘grafana-7.3.7-1.x86_64.rpm’

100%[============================================================================>] 53,729,497  13.5MB/s   in 5.6s

2021-01-20 16:30:00 (9.07 MB/s) - ‘grafana-7.3.7-1.x86_64.rpm’ saved [53729497/53729497]

FINISHED --2021-01-20 16:30:00--
Total wall clock time: 6.1s
Downloaded: 1 files, 51M in 5.6s (9.07 MB/s)

 

yum 으로 rpm 업그레이드 하기

이제 다운로드 받은 파일을 설치하도록 하겠습니다. `yum localinstall` 로 설치한 rpm 패키지는 `yum localupdate` 로 업데이트 할 수 있습니다. yum repo 를 사용하는 경우 `yum install` 과 `yum update` 를 설치와 업그레이드에 각각 사용하는 것과 마찬가지입니다. 

$ sudo yum localupdate grafana-7.3.7-1.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining grafana-7.3.7-1.x86_64.rpm: grafana-7.3.7-1.x86_64
Marking grafana-7.3.7-1.x86_64.rpm as an update to grafana-6.6.1-1.x86_64
Resolving Dependencies
--> Running transaction check
---> Package grafana.x86_64 0:6.6.1-1 will be updated
---> Package grafana.x86_64 0:7.3.7-1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
 Package                 Arch                   Version                 Repository                               Size
======================================================================================================================
Updating:
 grafana                 x86_64                 7.3.7-1                 /grafana-7.3.7-1.x86_64                 170 M

Transaction Summary
======================================================================================================================
Upgrade  1 Package

Total size: 170 M
Is this ok [y/d/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : grafana-7.3.7-1.x86_64                                                                             1/2
  Cleanup    : grafana-6.6.1-1.x86_64                                                                             2/2
POSTTRANS: Running script
  Verifying  : grafana-7.3.7-1.x86_64                                                                             1/2
  Verifying  : grafana-6.6.1-1.x86_64                                                                             2/2

Updated:
  grafana.x86_64 0:7.3.7-1

Complete!

 

확인!

이제 문제 없는지 확인을 해야겠죠? 웹 브라우저로 grafana 에 접근하여 좌측 하단에 있는 ? 버튼을 눌러 버전을 확인해 봅니다. 다행히도 백업한 파일을 사용할 일 없이 마무리가 잘 된 것 같습니다. 

 

728x90

+ Recent posts