博客
Lepus在运行过程中,需要依赖MySQL、ClickHouse、Redis、NSQ等基础组件作为数据存储和消息发送,在安装Lepus之前需要先安装这些基础组件,为了让大家更加快速的安装这些组件,特整理了此部署文档,给大家做为参考。
1.安装MySQL
配置MySQL yum源
# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
查看可用MySQL版本
yum repolist enabled | grep “mysql.*-community.*”
安装MySQL
yum -y install mysql-community-server
启动服务
service mysqld start //开启mysql服务
service mysqld stop //停止mysql服务
service mysqld restart //重启mysql服务
配置开机自启动
systemctl enable mysqld
查看MySQL状态
systemctl status mysql
修改root密码
mysqladmin -uroot -p password xxxxxx
登录mysql
mysql -uroot -p
创建数据库
mysql> create database lepus_db;
创建用户和授权
mysql> grant all on lepus_db.* to lepus@’%’ identified by ‘xxxxxx’;
2.安装clickhouse
配置ClickHouse yum源
sudo yum install -y yum-utils
sudo yum-config-manager –add-repo https://packages.clickhouse.com/rpm/clickhouse.repo
安装软件
sudo yum install -y clickhouse-server clickhouse-client
启动服务
sudo /etc/init.d/clickhouse-server start //启动前可以修改数据目录位置
clickhouse-client # or “clickhouse-client –password” if you set up a password.
默认本地连接,如果需要远程访问请修改配置
# vim /etc/clickhouse-server/config.xml
<listen_host>0.0.0.0</listen_host>
# sudo /etc/init.d/clickhouse-server reload
登录服务
# clickhouse-client -h127.0.0.1 –port 9000 -ulepus
创建数据库
create database lepus_db;
创建用户和授权
create user lepus identified with sha256_password by ‘xxxxxx’ host any;
grant select,insert,update,delete,create,alter,drop,truncate on lepus_db.* to lepus;
3.安装Redis
下载Redis软件包
# cd /usr/local/
# wget https://download.redis.io/releases/redis-5.0.8.tar.gz
安装Redis软件
# tar -zxvf redis-5.0.8.tar.gz
# ln -s redis-5.0.8 redis
# cd redis
# make
配置redis配置文件
vim reids.conf
# cat redis.conf |grep -v “^#” |grep -v “^$”
bind 0.0.0.0
protected-mode no
port 6379
tcp-backlog 511
timeout 86400
tcp-keepalive 300
daemonize yes
requirepass xxxxxx
supervised no
pidfile /usr/local/redis/redis_6379.pid
loglevel notice
logfile “/usr/local/redis/redis.log”
databases 16
dbfilename dump.rdb
dir /usr/local/redis/data/
创建数据目录
# mkdir data
启动redis
# ./src/redis-server redis.conf &
# ./src/redis-cli -p 6379-a xxxxxx
4.安装NGQ
下载软件包
# cd /usr/local/
# wget https://s3.amazonaws.com/bitly-downloads/nsq/nsq-1.3.0.linux-amd64.go1.21.5.tar.gz
安装软件
# tar -zxvf nsq-1.3.0.linux-amd64.go1.21.5.tar.gz
# ln -s nsq-1.3.0.linux-amd64.go1.21.5 nsq
启动服务
# nohup /usr/local/nsq/bin/nsqlookupd >/dev/null 2>nsqlookupd.log &
# nohup /usr/local/nsq/bin/nsqd –lookupd-tcp-address=127.0.0.1:4160 –broadcast-address=127.0.0.1 >/dev/null 2>nsqd.log &
# nohup /usr/local/nsq/bin/nsqadmin –lookupd-http-address=127.0.0.1:4161 >/dev/null 2>nsqadmin.log &
访问验证
启动完毕后登录IP:4171 进入NSQ管理界面。
版权声明:本文为LEPUS原创文章,如需转载请注明本站作者及本文链接,LEPUS保留一切法律解释权。
本文链接:https://www.lepus.cc/2024/11/24/lepus-install-require-database-and-nsq/