赞
踩
徐景周
- apt-get update
-
- apt-get install nano
查找Java安装路径
- which java
-
- ls /usr/bin/java (上一步结果路径)
-
- ls -lrt /etc/alternatives/java (上一步结果路径)
-
- ls /usr/lib/jvm/java-8-openjdk-amd64 (最终路径)
- systemctl stop firewalld
-
- systemctl disable firewalld
- sudo service cassandra stop
-
- sudo chkconfig cassandra off
-
- sudo service cassandra status
请浏览【参考文献 1】。
- sudo service docker stop
-
- mv /var/lib/docker /home/docker
-
- ln -s /home/docker /var/lib/docker
-
-
- sudo yum install -y nano
-
- sudo nano /usr/lib/systemd/system/docker.service
-
- 文件修改项如下:
-
- ExecStart=/usr/bin/dockerd --graph /home/docker -H fd:// --containerd=/run/containerd/containerd.soc
-
-
- sudo systemctl daemon-reload
-
- sudo service docker restart
-
- sudo service docker status
-
- docker info | grep Dir
- df -h
-
- docker info
-
- docker exec -it tb-cassandra df -h
sudo systemctl enable docker
1. 操作指令
安装
- docker stop tb-cassandra
- docker rm tb-cassandra
-
- docker run --name tb-cassandra -p 7000:7000 -p 7001:7001 -p 7199:7199 -p 9042:9042 -p 9160:9160 -d cassandra:3.0
docker start tb-cassandra
docker ps -a
docker update --restart=always 容器ID
2. 实现细节
请浏览【参考文献 2】和【参考文献 3】。
1. 操作指令
docker exec -it tb-cassandra bash
cqlsh
update system.local set cluster_name = 'Thingsboard Cluster' where key='local';
select cluster_name from system.local;
exit
nodetool flush system
- nano /etc/cassandra/cassandra.yaml
-
- 或者采用文件替换方式(先退出docker bash)
-
- docker exec -it tb-cassandra bash
-
- ls etc/cassandra/cassandra.yaml
-
- exit;
-
-
- docker ps
-
- docker cp cassandra.yaml 容器id:/etc/cassandra/cassandra.yaml
-
-
- docker exec -it tb-cassandra bash
-
- cat /etc/cassandra/cassandra.yaml
Cassandra.yaml配置文件修改
创建目录及修改属性
- ls /var/lib/cassandra/
-
- mkdir /var/lib/cassandra/data
-
- mkdir /var/lib/cassandra/commitlog
-
- mkdir /var/lib/cassandra/saved_caches
-
- mkdir /var/lib/cassandra/hints
-
- chown 777 /var/lib/cassandra/data
-
- chown 777 /var/lib/cassandra/commitlog
-
- chown 777 /var/lib/cassandra/saved_caches
-
- chown 777 /var/lib/cassandra/hints
修改文件下面的选项
- cluster_name: 'Thingsboard Cluster’
-
- hints_directory: /var/lib/cassandra/hints
-
- data_file_directories:
-
- - /var/lib/cassandra/data
-
- commitlog_directory: /var/lib/cassandra/commitlog
-
- saved_caches_directory: /var/lib/cassandra/saved_caches
-
- seeds: "127.0.0.1”
- listen_address: localhost
- # broadcast_address: 1.2.3.4
- start_rpc: true
- rpc_address: 0.0.0.0
- broadcast_rpc_address: 1.2.3.4
exit;
- docker ps
-
- docker cp schema-ts.cql 容器id:/root/schema-ts.cql
-
- docker cp schema-entities.cql 容器id:/root/schema-entities.cql
-
-
- docker exec -it tb-cassandra bash
-
- ls /root
-
- cqlsh -f /root/schema-entities.cql
-
- cqlsh -f /root/schema-ts.cql
-
- exit;
docker restart tb-cassandra
docker logs tb-cassandra
实现细节
请浏览【参考文献4】和【参考文献 5】。
- # DB Configuration
- export DATABASE_ENTITIES_TYPE=sql
-
- export DATABASE_TS_TYPE=cassandra
-
- export SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect
-
- export SPRING_DR
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。