游戏开奖网站建设,汽车展示网站,网页代码是什么语言,可以用自己电脑做网站吗注意#xff1a;建议使用3.6.0#xff0c;我升级到3.7.1#xff0c;并没有多什么新功能#xff0c;反而电表的实时数据只能看到累计电能了#xff0c;我回退了就正常#xff0c;数据库是兼容的#xff0c;java版本换位java11#xff0c;其他不变就好
背景#xff1a;…注意建议使用3.6.0我升级到3.7.1并没有多什么新功能反而电表的实时数据只能看到累计电能了我回退了就正常数据库是兼容的java版本换位java11其他不变就好
背景 国外欧标充电桩开发中服务器对接是很重要的一环出国外的基本都是需要支持OCPP功能基本要求是OCPP1.6还有些客户已经开始要2.0了OCPP测试至关重要目前有两种测试方法1使用Monta服务器去注册一个账号然后链接调试即可2.自己在云端搭建一个自己的OCPP平台SteVe。 两个平台我都有使用用得多并且顺手的是SteVe平台。以下是简单总结一下使用后的感受。 Monta平台界面比较单一下发的命令的应答只能看log里面找到对应的应答数据json优点是有认证测试功能可以免费自己注册一个账号就能使用免费https://ocpp-toolkit.monta.app/
SteVe平台界面丰富可以管理ocpp tags充电卡或者get configration的时候预设很多系统的key使用应答命令会帮你解析在页面显示出来目前SteVe平台是最完善的并且是开源免费的。
综上所述自己搭建一个服务器就很有必要了。
SteVe平台搭建主要流程
1.先准备一个云服务器如果没有云服务器可以考虑用虚拟机安装一个centos7然后把这个机器映射到外网临时用也行。2.下载SteVe官方源码包我这里就用3.17.1举例。官方源码在GitHub https://github.com/steve-community/steve。3.数据库MYSQL8的安装与配置因为CentOS使用的是mariadb但你去编译SteVe的时候你会发现提示非长期支持版会报错。4.安装Java17Centos内置了Java工具但查看版本发现是1.8的SteVe3.7.1要求是Java17删除Java1.8再安装Java17.5.编译SteVe源码。6.运行测试7.制作开机自启。
详细步骤 1.下载SteVe源码。并阅读README.md了解这个平台需要用到的环境先配置好这些环境然后了解编译工具和编译运行。经过阅读发现需要使用mysql8java17Maven 2.首先来安装数据库数据库MYSQL8的安装与配置查看当前mariadb版本信息。
rpm -e --nodeps 上一条命令列出的文件名。 rpm -qa|grep mariadb 用于检查是否卸载干净。
让AI帮忙写了一个centos7安装mysql8的脚步这样比传统的下载安装更省事
#!/bin/bash# Exit script on any error
set -e# Fixed password to be used
fixed_passwordMsb666666# 1. Add the MySQL Yum repository
echo Adding the MySQL Yum repository...
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpmecho Checking the integrity of the downloaded package...
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysqlecho Installing the MySQL Yum repository...
yum localinstall mysql80-community-release-el7-3.noarch.rpm -y# 2. Install the MySQL server
echo Installing the MySQL server...
yum install mysql-community-server -y# 3. Start the MySQL service
echo Starting the MySQL service...
systemctl start mysqld
systemctl enable mysqld# 4. Get the temporary password generated for the root user
echo Retrieving the temporary password...
temp_password$(grep temporary password /var/log/mysqld.log | tail -1 | rev | cut -d -f1 | rev)echo The temporary MySQL root password is: $temp_password# 5. Change the root users password to the desired fixed password
echo Changing the root users password...mysql --connect-expired-password -uroot -p$temp_password -EOF
ALTER USER rootlocalhost IDENTIFIED BY $fixed_password;
FLUSH PRIVILEGES;
EOFecho The root password has been successfully changed to the fixed password.# Optionally, you can run the mysql_secure_installation steps here if you want to automate it further.echo MySQL 8 installation is complete.还有mysql运行脚本
#!/bin/bash# This script starts the MySQL service and sets it to launch on boot# Exit script on any error
set -e# Start the MySQL service
echo Starting the MySQL service...
systemctl start mysqld# Enable the MySQL service to start on boot
echo Setting the MySQL service to start on boot...
systemctl enable mysqld# Confirmation message
echo MySQL service has been started and set to launch on boot.安装好了之后通过ssh命令行登陆数据库
mysql -u root接下来为steve创建相关数据
steve 数据库mysql8 用户名root 密码Msb666666, Steve数据库用户名steve 密码changeme
脚本安装后需要更新默认的随机密码密码不能太简单需要带点符合否则会失败
ALTER USER rootlocalhost IDENTIFIED BY Msb666666,;
FLUSH PRIVILEGES;创建SteVe需要用到的数据库stevedb
CREATE DATABASE stevedb CHARACTER SET utf8 COLLATE utf8_unicode_ci;创建完毕后可以使用命令查看一下可以看到Stevedb
mysql show databases;
--------------------
| Database |
--------------------
| information_schema |
| mysql |
| performance_schema |
| stevedb |
| sys |
--------------------
5 rows in set (0.00 sec)再为这个数据创建一个数据库用户steve这个和SteVe平台README.md默认用户名和密码保持一致否则两边一起改。
CREATE USER stevelocalhost IDENTIFIED BY changeme;
GRANT ALL PRIVILEGES ON stevedb.* TO stevelocalhost;
GRANT SUPER ON *.* TO stevelocalhost;然后退出数据库尝试使用新数据库用户登陆 mysql -u steve -pType help; or \h for help. Type \c to clear the current input statement.mysql show databases;
--------------------
| Database |
--------------------
| information_schema |
| performance_schema |
| stevedb |
--------------------
3 rows in set (0.00 sec)mysql 这样就完成了不需要建表这个SteVe在打包编译和运行的时候都会自动建表。 编译之前还需要改一下数据库默认时区解决java编译的时候时区问题。 vi /etc/my.cnf增加default-time-zone‘08:00’
重启数据库 systemctl restart mysqld数据库好了还需要Java运行环境 yum install java-17-openjdk-devel如果系统里有多个java版本可以使用alternatives来切换
CentOS 支持通过 alternatives 命令来管理多个版本的 Java。您可以按照以下步骤进行设置
alternatives --install /usr/bin/javac java /usr/lib/jvm/temurin-17-jdk/bin/java 1
alternatives --install /usr/bin/javac javac /usr/lib/jvm/temurin-17-jdk/bin/javac 1sudo alternatives --config java选择Java17即可
修改Steve代码 修改Java代码改到上海时区东八区方便测试使用
public class Application implements ApplicationStarter, AutoCloseable {private final ApplicationStarter delegate;public Application() {// For Hibernate validatorSystem.setProperty(org.jboss.logging.provider, slf4j);SteveConfiguration sc SteveConfiguration.CONFIG;log.info(Loaded the properties. Starting with the {} profile, sc.getProfile());// 设置java.util.TimeZone的默认时区为东八区TimeZone.setDefault(TimeZone.getTimeZone(Asia/Shanghai)); DateTimeZone.setDefault(DateTimeZone.forID(Asia/Shanghai));//TimeZone.setDefault(TimeZone.getTimeZone(sc.getTimeZoneId()));//DateTimeZone.setDefault(DateTimeZone.forID(sc.getTimeZoneId()));log.info(Date/time zone of the application is set to {}. Current date/time: {}, sc.getTimeZoneId(), DateTime.now());switch (sc.getProfile()) {case DEV:默认的配置部署到服务器是无法正常访问的需要修改一下配置数据库部分一定要和前面配置的数据库的鞥冷信息和端口一样网页登录信息建议改为自己的密码最好还是随机密码修改的java配置文件在src\main\resources\config\prod\main.properties
# Just to be backwards compatible with previous versions, this is set to steve,
# since there might be already configured chargepoints expecting the older path.
# Otherwise, might as well be changed to something else or be left empty.
#
context.path steve# Database configuration
#
db.ip 127.0.0.1
db.port 3306
db.schema stevedb
db.user steve
db.password changeme# Credentials for Web interface access
#
auth.user admin
auth.password 写上你的密码# The header key and value for Web API access using API key authorization.
# Both must be set for Web APIs to be enabled. Otherwise, we will block all calls.
#
webapi.key STEVE-API-KEY
webapi.value # Jetty configuration
#
server.host 0.0.0.0
server.gzip.enabled true# Jetty HTTP configuration
#
http.enabled true
http.port 8080# Jetty HTTPS configuration
#
https.enabled false
https.port 8443
keystore.path
keystore.password # When the WebSocket/Json charge point opens more than one WebSocket connection,
# we need a mechanism/strategy to select one of them for outgoing requests.
# For allowed values see de.rwth.idsg.steve.ocpp.ws.custom.WsSessionSelectStrategyEnum.
#
ws.session.select.strategy ALWAYS_LAST# if BootNotification messages arrive (SOAP) or WebSocket connection attempts are made (JSON) from unknown charging
# stations, we reject these charging stations, because stations with these chargeBoxIds were NOT inserted into database
# beforehand. by setting this property to true, this behaviour can be modified to automatically insert unknown
# stations into database and accept their requests.
#
# CAUTION: setting this property to true is very dangerous, because we will accept EVERY BootNotification or WebSocket
# connection attempt from ANY sender as long as the sender knows the URL and sends a valid message.
#
auto.register.unknown.stations false# if this field is set, it will take precedence over the default regex we are using in
# de.rwth.idsg.steve.web.validation.ChargeBoxIdValidator.REGEX to validate the format of the chargeBoxId values
#
charge-box-id.validation.regex ### DO NOT MODIFY ###
steve.version ${project.version}
git.describe ${git.commit.id.describe}
db.sql.logging false
profile prod安装Maven工具这个是编译这个项目必不可少的工具
wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repoyum install -y apache-maven[rootiZj6cagyhi0qjy83boeqcyZ ~]# mvn -version
Apache Maven 3.0.5 (Red Hat 3.0.5-17)
Maven home: /usr/share/maven
Java version: 17.0.13, vendor: Eclipse Adoptium
Java home: /usr/lib/jvm/temurin-17-jdk
Default locale: en_US, platform encoding: UTF-8
OS name: linux, version: 3.10.0-1160.114.2.el7.x86_64, arch: amd64, family: unix编译代码生成Java应用程序
./mvnw package执行并测试
/usr/bin/java -jar /home/steve3.7.1/target/steve.jar打开网页 能打开基本就成功了登陆用户名和密码是src\main\resources\config\prod\main.properties里面的
# Credentials for Web interface access
#
auth.user admin
auth.password 写上你的密码手工执行通过后可以制作自启动Steve服务器
vi /etc/systemd/system/steve.service[Unit]
DescriptionSteve Java Application[Service]
Userroot# 替换为实际运行该服务的系统用户名
ExecStart/usr/bin/java -jar /home/steve3.7.1/target/steve.jar
WorkingDirectory/home/steve3.7.1/target # 确保这是jar文件所在的目录
SuccessExitStatus143 # java进程退出码为143表示正常退出
TimeoutStopSec10
Restarton-failure # 服务失败时进行重启
RestartSec5 # 重启间隔时间[Install]
WantedBymulti-user.targetsystemctl daemon-reload
systemctl enable steve.service
systemctl start steve.service
systemctl status steve.service//重启服务用户修改了服务源码重启服务生效。
systemctl restart steve.service
文章转载自: http://www.morning.wddmr.cn.gov.cn.wddmr.cn http://www.morning.c7495.cn.gov.cn.c7495.cn http://www.morning.rwnx.cn.gov.cn.rwnx.cn http://www.morning.wdhlc.cn.gov.cn.wdhlc.cn http://www.morning.wkqrp.cn.gov.cn.wkqrp.cn http://www.morning.hmwjk.cn.gov.cn.hmwjk.cn http://www.morning.c7627.cn.gov.cn.c7627.cn http://www.morning.jfjfk.cn.gov.cn.jfjfk.cn http://www.morning.trjp.cn.gov.cn.trjp.cn http://www.morning.lnwdh.cn.gov.cn.lnwdh.cn http://www.morning.ndcf.cn.gov.cn.ndcf.cn http://www.morning.mnyzz.cn.gov.cn.mnyzz.cn http://www.morning.rkfxc.cn.gov.cn.rkfxc.cn http://www.morning.stsnf.cn.gov.cn.stsnf.cn http://www.morning.fxzlg.cn.gov.cn.fxzlg.cn http://www.morning.wbns.cn.gov.cn.wbns.cn http://www.morning.ltbwq.cn.gov.cn.ltbwq.cn http://www.morning.jcrfm.cn.gov.cn.jcrfm.cn http://www.morning.prsxj.cn.gov.cn.prsxj.cn http://www.morning.wqhlj.cn.gov.cn.wqhlj.cn http://www.morning.bdgb.cn.gov.cn.bdgb.cn http://www.morning.mdwtm.cn.gov.cn.mdwtm.cn http://www.morning.rbgqn.cn.gov.cn.rbgqn.cn http://www.morning.tpbhf.cn.gov.cn.tpbhf.cn http://www.morning.qfkxj.cn.gov.cn.qfkxj.cn http://www.morning.mswkd.cn.gov.cn.mswkd.cn http://www.morning.qmbgb.cn.gov.cn.qmbgb.cn http://www.morning.rcjqgy.com.gov.cn.rcjqgy.com http://www.morning.gktds.cn.gov.cn.gktds.cn http://www.morning.lcxdm.cn.gov.cn.lcxdm.cn http://www.morning.sbkb.cn.gov.cn.sbkb.cn http://www.morning.yxdrf.cn.gov.cn.yxdrf.cn http://www.morning.ghwdm.cn.gov.cn.ghwdm.cn http://www.morning.rhjhy.cn.gov.cn.rhjhy.cn http://www.morning.crxdn.cn.gov.cn.crxdn.cn http://www.morning.qdbcd.cn.gov.cn.qdbcd.cn http://www.morning.ishoufeipin.cn.gov.cn.ishoufeipin.cn http://www.morning.tnhqr.cn.gov.cn.tnhqr.cn http://www.morning.jrhcp.cn.gov.cn.jrhcp.cn http://www.morning.xrksf.cn.gov.cn.xrksf.cn http://www.morning.yqkxr.cn.gov.cn.yqkxr.cn http://www.morning.wqmpd.cn.gov.cn.wqmpd.cn http://www.morning.bynf.cn.gov.cn.bynf.cn http://www.morning.smdiaosu.com.gov.cn.smdiaosu.com http://www.morning.rmpfh.cn.gov.cn.rmpfh.cn http://www.morning.gqryh.cn.gov.cn.gqryh.cn http://www.morning.mfsjn.cn.gov.cn.mfsjn.cn http://www.morning.gfjgq.cn.gov.cn.gfjgq.cn http://www.morning.ampingdu.com.gov.cn.ampingdu.com http://www.morning.taipinghl.cn.gov.cn.taipinghl.cn http://www.morning.tgyzk.cn.gov.cn.tgyzk.cn http://www.morning.rlfr.cn.gov.cn.rlfr.cn http://www.morning.mnmrx.cn.gov.cn.mnmrx.cn http://www.morning.ygkk.cn.gov.cn.ygkk.cn http://www.morning.nktgj.cn.gov.cn.nktgj.cn http://www.morning.snccl.cn.gov.cn.snccl.cn http://www.morning.msgcj.cn.gov.cn.msgcj.cn http://www.morning.rlzxr.cn.gov.cn.rlzxr.cn http://www.morning.cptzd.cn.gov.cn.cptzd.cn http://www.morning.drywd.cn.gov.cn.drywd.cn http://www.morning.clyhq.cn.gov.cn.clyhq.cn http://www.morning.fqssx.cn.gov.cn.fqssx.cn http://www.morning.gtylt.cn.gov.cn.gtylt.cn http://www.morning.hmjasw.com.gov.cn.hmjasw.com http://www.morning.klyzg.cn.gov.cn.klyzg.cn http://www.morning.rcjqgy.com.gov.cn.rcjqgy.com http://www.morning.xczyj.cn.gov.cn.xczyj.cn http://www.morning.mcqhb.cn.gov.cn.mcqhb.cn http://www.morning.phlrp.cn.gov.cn.phlrp.cn http://www.morning.ngpdk.cn.gov.cn.ngpdk.cn http://www.morning.zrqs.cn.gov.cn.zrqs.cn http://www.morning.fbxdp.cn.gov.cn.fbxdp.cn http://www.morning.mfnsn.cn.gov.cn.mfnsn.cn http://www.morning.znqxt.cn.gov.cn.znqxt.cn http://www.morning.mjbkp.cn.gov.cn.mjbkp.cn http://www.morning.nxwk.cn.gov.cn.nxwk.cn http://www.morning.pshpx.cn.gov.cn.pshpx.cn http://www.morning.tqgx.cn.gov.cn.tqgx.cn http://www.morning.jcrfm.cn.gov.cn.jcrfm.cn http://www.morning.fgxnb.cn.gov.cn.fgxnb.cn