安装thingsboard数据库

本文详细介绍如何在Linux环境下安装和配置PostgreSQL及Cassandra数据库,包括系统更新、安装、初始化、配置自动启动、设置密码、编辑配置文件以及创建ThingsboardDB等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

配置ThingsBoard数据库

PostgreSQL安装

# Update your system
sudo yum update
# Install the repository RPM:
sudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Install packages
sudo yum install postgresql10-server postgresql10-contrib
# Initialize your PostgreSQL DB
sudo /usr/pgsql-10/bin/postgresql-10-setup initdb
sudo systemctl start postgresql-10
# Optional: Configure PostgreSQL to start on boot
sudo systemctl enable postgresql-10

img

img

img

img

img

安装好会自动创建了一个PostgreSQL用户postgres

配置密码:

sudo su - postgres
psql
\password
123456
\q

这里的123456是我设置的密码。

img

然后,按“ Ctrl + D”返回主用户控制台。

编辑pg_hba.conf以对postgres用户使用MD5认证。

编辑pg_hba.conf文件:

vim /var/lib/pgsql/10/data/pg_hba.conf

把这一行的ident改成md5

img

修改为:

img

重新启动PostgreSQL服务以初始化新配置:

sudo systemctl restart postgresql-10.service

连接到数据库以创建Thingsboard DB:

psql -U postgres -d postgres -h 127.0.0.1 -W
CREATE DATABASE thingsboard;
\q

img

2.4 Cassandra安装

# Add cassandra repository
sudo touch /etc/yum.repos.d/datastax.repo
echo '[datastax]' | sudo tee --append /etc/yum.repos.d/datastax.repo > /dev/null
echo 'name = DataStax Repo for Apache Cassandra' | sudo tee --append /etc/yum.repos.d/datastax.repo > /dev/null
echo 'baseurl = http://rpm.datastax.com/community' | sudo tee --append /etc/yum.repos.d/datastax.repo > /dev/null
echo 'enabled = 1' | sudo tee --append /etc/yum.repos.d/datastax.repo > /dev/null
echo 'gpgcheck = 0' | sudo tee --append /etc/yum.repos.d/datastax.repo > /dev/null
 
# Cassandra installation
sudo yum install dsc30
# Tools installation
sudo yum install cassandra30-tools
# Start Cassandra
sudo service cassandra start
# Configure the database to start automatically when OS starts.
sudo chkconfig cassandra on

img

img

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值