一、开发环境准备
-
安装jdk,版本:jdk1.8
-
安装Maven,版本:3.6.1
-
安装git,版本:2.21.0
-
安装Node js,版本10.16.0 一定要和源码中
pom
文件下的一致,否则在使用npm编译不通过 -
安装所需要的模块
npm install -g cross-env
npm install -g webpack
npm install --global gulp
-
使用git从官方仓库克隆项目
二、编译项目,导入idea
-
进入thangsboard根目录,Maven编译项目
mvn clean install –DskipTests
mvn clean install –DskipTests
-
导入idea
- 配置JDK
- 支持es6语法
- 安装Lombok插件
-
安装postgresql数据库
-
使用Navcat连接数据库,在thingsboard项目中找到sql文件(dao-src-main-resources-sql),Navcat中执行sql文件。
-
安装Redis,(不懂为什么要安装!)
-
修改
thonfsboard.yml
文件# 注释掉 # Cassandra driver configuration parameters #cassandra: # # Thingsboard cluster name # cluster_name: "${CASSANDRA_CLUSTER_NAME:Thingsboard Cluster}" # # Thingsboard keyspace name # keyspace_name: "${CASSANDRA_KEYSPACE_NAME:thingsboard}" # # Specify node list # url: "${CASSANDRA_URL:127.0.0.1:9042}" # # Enable/disable secure connection # ssl: "${CASSANDRA_USE_SSL:false}" # # Enable/disable JMX # jmx: "${CASSANDRA_USE_JMX:true}" # # Enable/disable metrics collection. # metrics: "${CASSANDRA_DISABLE_METRICS:true}" # # NONE SNAPPY LZ4 # compression: "${CASSANDRA_COMPRESSION:none}" # # Specify cassandra cluster initialization timeout in milliseconds (if no hosts available during startup) # init_timeout_ms: "${CASSANDRA_CLUSTER_INIT_TIMEOUT_MS:300000}" # # Specify cassandra claster initialization retry interval (if no hosts available during startup) # init_retry_interval_ms: "${CASSANDRA_CLUSTER_INIT_RETRY_INTERVAL_MS:3000}" # max_requests_per_connection_local: "${CASSANDRA_MAX_REQUESTS_PER_CONNECTION_LOCAL:32768}" # max_requests_per_connection_remote: "${CASSANDRA_MAX_REQUESTS_PER_CONNECTION_REMOTE:32768}" # # Credential parameters # # credentials: "${CASSANDRA_USE_CREDENTIALS:false}" # # Specify your username # username: "${CASSANDRA_USERNAME:}" # # Specify your password # password: "${CASSANDRA_PASSWORD:}" # # # Cassandra cluster connection socket parameters # # socket: # connect_timeout: "${CASSANDRA_SOCKET_TIMEOUT:5000}" # read_timeout: "${CASSANDRA_SOCKET_READ_TIMEOUT:20000}" # keep_alive: "${CASSANDRA_SOCKET_KEEP_ALIVE:true}" # reuse_address: "${CASSANDRA_SOCKET_REUSE_ADDRESS:true}" # so_linger: "${CASSANDRA_SOCKET_SO_LINGER:}" # tcp_no_delay: "${CASSANDRA_SOCKET_TCP_NO_DELAY:false}" # receive_buffer_size: "${CASSANDRA_SOCKET_RECEIVE_BUFFER_SIZE:}" # send_buffer_size: "${CASSANDRA_SOCKET_SEND_BUFFER_SIZE:}" # # # Cassandra cluster connection query parameters # # query: # read_consistency_level: "${CASSANDRA_READ_CONSISTENCY_LEVEL:ONE}" # write_consistency_level: "${CASSANDRA_WRITE_CONSISTENCY_LEVEL:ONE}" # default_fetch_size: "${CASSANDRA_DEFAULT_FETCH_SIZE:2000}" # # Specify partitioning size for timestamp key-value storage. Example MINUTES, HOURS, DAYS, MONTHS,INDEFINITE # ts_key_value_partitioning: "${TS_KV_PARTITIONING:MONTHS}" # ts_key_value_ttl: "${TS_KV_TTL:0}" # events_ttl: "${TS_EVENTS_TTL:0}" # # Specify TTL of debug log in seconds. The current value corresponds to one week # debug_events_ttl: "${DEBUG_EVENTS_TTL:604800}" # buffer_size: "${CASSANDRA_QUERY_BUFFER_SIZE:200000}" # concurrent_limit: "${CASSANDRA_QUERY_CONCURRENT_LIMIT:1000}" # permit_max_wait_time: "${PERMIT_MAX_WAIT_TIME:120000}" # dispatcher_threads: "${CASSANDRA_QUERY_DISPATCHER_THREADS:2}" # callback_threads: "${CASSANDRA_QUERY_CALLBACK_THREADS:4}" # poll_ms: "${CASSANDRA_QUERY_POLL_MS:50}" # rate_limit_print_interval_ms: "${CASSANDRA_QUERY_RATE_LIMIT_PRINT_MS:10000}" # # set all data types values except target to null for the same ts on save # set_null_values_enabled: "${CASSANDRA_QUERY_SET_NULL_VALUES_ENABLED:false}" # tenant_rate_limits: # enabled: "${CASSANDRA_QUERY_TENANT_RATE_LIMITS_ENABLED:false}" # configuration: "${CASSANDRA_QUERY_TENANT_RATE_LIMITS_CONFIGURATION:1000:1,30000:60}" # print_tenant_names: "${CASSANDRA_QUERY_TENANT_RATE_LIMITS_PRINT_TENANT_NAMES:false}"
# 修改数据库名,密码,连接 # SQL DAO Configuration spring: data: jpa: repositories: enabled: "true" jpa: hibernate: ddl-auto: "none" database-platform: "${SPRING_JPA_DATABASE_PLATFORM:org.hibernate.dialect.PostgreSQLDialect}" datasource: driverClassName: "${SPRING_DRIVER_CLASS_NAME:org.postgresql.Driver}" # 修改连接 url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/postgres}" # 修改数据库名 username: "${SPRING_DATASOURCE_USERNAME:postgres}" # 修改密码 password: "${SPRING_DATASOURCE_PASSWORD:112358}"
-
在idea中运行项目,如果没有报错即将大功告成(正常不会报错的),此时已经可以登录thingsboard了。,访问http://localhost:8080登陆。用户名:sysadmin@thingsboard.org密码:sysadmin
三、编译UI(可编可不编?)
- 命令行下进入ui根目录,执行
npm install
npm run build
npm run start
- 将会开启监听3000端口,访问http://localhost:3000 登录即可。(后台代码和前端需同时运行!)
四、安装完成后的事宜
-
登录,两个端口都可。用户名:sysadmin@thingsboard.org密码:sysadmin
-
点击添加租户
-
管理租户管理员
-
添加新用户
-
验证密码后使用新租户管理员登录
尽情的玩耍吧!!
五、参考
https://blog.csdn.net/curly_d/article/details/89884604
https://blog.csdn.net/julyqian/article/details/88081367