首页
友链
关于
免责声明
Search
1
王者营地战绩数据王者荣耀查询网页源码
6,210 阅读
2
群晖Active Backup for Business套件备份Linux服务器教程
4,384 阅读
3
影视分享
4,313 阅读
4
(亲测)Jrebel激活破解方式2019-08-21
4,289 阅读
5
centos7 安装及卸载 jekenis
3,573 阅读
日常
文章
后端
前端
Linux
异常
Flutter
分享
群辉
登录
Search
标签搜索
docker
springboot
Spring Boot
java
linux
Shiro
Graphics2D
图片
游戏账号交易
Mybatis
Spring Cloud
centos
脚本
Web Station
群辉
王者营地
战绩查询
平台对接
Spring Cloud Alibaba
nacos
绿林寻猫
累计撰写
249
篇文章
累计收到
26
条评论
首页
栏目
日常
文章
后端
前端
Linux
异常
Flutter
分享
群辉
页面
友链
关于
免责声明
搜索到
52
篇与
Linux
的结果
2021-12-08
tomcat配置强制https访问
在 tomcat /conf/web.xml 中的 </welcome-file-list> 后面加上以下内容 <login-config> <!-- Authorization setting for SSL --> <auth-method>CLIENT-CERT</auth-method> <realm-name>Client Cert Users-only Area</realm-name> </login-config> <security-constraint> <!-- Authorization setting for SSL --> <web-resource-collection> <web-resource-name>SSL</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>示例:
2021年12月08日
195 阅读
0 评论
0 点赞
2021-12-08
Java连接mqtt服务器(发送、订阅)
<dependency> <groupId>org.eclipse.paho</groupId> <artifactId>org.eclipse.paho.client.mqttv3</artifactId> <version>1.2.2</version> </dependency>1.模拟客户端接收消息import java.util.concurrent.ScheduledExecutorService; import org.eclipse.paho.client.mqttv3.MqttClient; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.MqttTopic; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; /** * 模拟一个客户端接收消息 * * @author Unclue_liu */ public class ClientMQTT { public static final String HOST = "tcp://192.168.1.77:1883"; public static final String TOPIC1 = "pos_message_all"; private static final String clientid = "12345678"; private MqttClient client; private MqttConnectOptions options; private String userName = "mqtt"; //非必须 private String passWord = "mqtt"; //非必须 private ScheduledExecutorService scheduler; private void start() { try { // host为主机名,clientid即连接MQTT的客户端ID,一般以唯一标识符表示,MemoryPersistence设置clientid的保存形式,默认为以内存保存 client = new MqttClient(HOST, clientid, new MemoryPersistence()); // MQTT的连接设置 options = new MqttConnectOptions(); // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,设置为true表示每次连接到服务器都以新的身份连接 options.setCleanSession(false); // 设置连接的用户名 options.setUserName(userName); // 设置连接的密码 options.setPassword(passWord.toCharArray()); // 设置超时时间 单位为秒 options.setConnectionTimeout(10); // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制 options.setKeepAliveInterval(20); //设置断开后重新连接 options.setAutomaticReconnect(true); // 设置回调 client.setCallback(new PushCallback()); MqttTopic topic = client.getTopic(TOPIC1); //setWill方法,如果项目中需要知道客户端是否掉线可以调用该方法。设置最终端口的通知消息 //遗嘱 options.setWill(topic, "close".getBytes(), 1, true); client.connect(options); //订阅消息 int[] Qos = {1};//0:最多一次 、1:最少一次 、2:只有一次 String[] topic1 = {TOPIC1}; client.subscribe(topic1, Qos); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { ClientMQTT client = new ClientMQTT(); client.start(); }2.模拟服务端发送消息import org.eclipse.paho.client.mqttv3.MqttClient; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.MqttDeliveryToken; import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.MqttPersistenceException; import org.eclipse.paho.client.mqttv3.MqttTopic; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; /** * Title:Server 这是发送消息的服务端 * Description: 服务器向多个客户端推送主题,即不同客户端可向服务器订阅相同主题 * @author Unclue_liu */ public class ServerMQTT { //tcp://MQTT安装的服务器地址:MQTT定义的端口号 public static final String HOST = "tcp://192.168.1.77:1883"; //定义一个主题 public static final String TOPIC = "pos_message_all"; //定义MQTT的ID,可以在MQTT服务配置中指定 private static final String clientid = "server11"; private MqttClient client; private static MqttTopic topic11; // private String userName = "mqtt"; //非必须 // private String passWord = "mqtt"; //非必须 private static MqttMessage message; /** * 构造函数 * @throws MqttException */ public ServerMQTT() throws MqttException { // MemoryPersistence设置clientid的保存形式,默认为以内存保存 client = new MqttClient(HOST, clientid, new MemoryPersistence()); connect(); } /** * 用来连接服务器 */ private void connect() { MqttConnectOptions options = new MqttConnectOptions(); options.setCleanSession(false); // options.setUserName(userName); // options.setPassword(passWord.toCharArray()); // 设置超时时间 options.setConnectionTimeout(10); // 设置会话心跳时间 options.setKeepAliveInterval(20); try { client.setCallback(new PushCallback()); client.connect(options); topic11 = client.getTopic(TOPIC); } catch (Exception e) { e.printStackTrace(); } } /** * * @param topic * @param message * @throws MqttPersistenceException * @throws MqttException */ public static void publish(MqttTopic topic , MqttMessage message) throws MqttPersistenceException, MqttException { MqttDeliveryToken token = topic.publish(message); token.waitForCompletion(); System.out.println("message is published completely! " + token.isComplete()); } public static void sendMessage(String clieId,String msg)throws Exception{ ServerMQTT server = new ServerMQTT(); server.message = new MqttMessage(); server.message.setQos(1); //保证消息能到达一次 server.message.setRetained(true); String str ="{\"clieId\":\""+clieId+"\",\"mag\":\""+msg+"\"}"; server.message.setPayload(str.getBytes()); try{ publish(server.topic11 , server.message); //断开连接 // server.client.disconnect(); }catch (Exception e){ e.printStackTrace(); } } /** * 启动入口 * @param args * @throws MqttException */ public static void main(String[] args) throws Exception { sendMessage("123444","哈哈"); } }3.发布消息回调类import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; import org.eclipse.paho.client.mqttv3.MqttCallback; import org.eclipse.paho.client.mqttv3.MqttMessage; /** * 发布消息的回调类 * * 必须实现MqttCallback的接口并实现对应的相关接口方法CallBack 类将实现 MqttCallBack。 * 每个客户机标识都需要一个回调实例。在此示例中,构造函数传递客户机标识以另存为实例数据。 * 在回调中,将它用来标识已经启动了该回调的哪个实例。 * 必须在回调类中实现三个方法: * * public void messageArrived(MqttTopic topic, MqttMessage message)接收已经预订的发布。 * * public void connectionLost(Throwable cause)在断开连接时调用。 * * public void deliveryComplete(MqttDeliveryToken token)) * 接收到已经发布的 QoS 1 或 QoS 2 消息的传递令牌时调用。 * 由 MqttClient.connect 激活此回调。 * */ public class PushCallback implements MqttCallback { public void connectionLost(Throwable cause) { // 连接丢失后,一般在这里面进行重连 System.out.println("连接断开,可以做重连"); } public void deliveryComplete(IMqttDeliveryToken token) { System.out.println("deliveryComplete---------" + token.isComplete()); } public void messageArrived(String topic, MqttMessage message) throws Exception { // subscribe后得到的消息会执行到这里面 System.out.println("接收消息主题 : " + topic); System.out.println("接收消息Qos : " + message.getQos()); System.out.println("接收消息内容 : " + new String(message.getPayload())); } }
2021年12月08日
55 阅读
0 评论
0 点赞
2021-12-08
Centos 服务器 安装 JDK、Tomcat、Mysql
配置JAVA环境 查看yum库中的Java安装包 yum -y list java* 输入之后回车,会看到各种不同版本的jdk包使用yum安装Java环境安装java-1.8.0版本的所有相关程序yum -y install java-1.8.0-openjdk* 出现complete!说明安装结束 查看刚安装的Java版本信息 java -version 出现下图信息,说明安装成功 配置环境变量由上可知java的路径为: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64打开文件vi /etc/profile 在文件最后一行添加export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64export JRE_HOME=${JAVA_HOME}/jreexport CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/libexport PATH=${JAVA_HOME}/bin:$PATH使其生效 source /etc/profile//查看是否配置成功echo $PATH 配置Tomcat转自 https://blog.csdn.net/TheBlackbeard/article/details/52549763 关于LINUX权限-bash: ./startup.sh: Permission denied在执行./startup.sh,或者./shutdown.sh的时候,爆出了Permission denied,其实很简单,就是今天在执行tomcat的时候,用户没有权限,而导致无法执行,用命令chmod 修改一下bin目录下的.sh权限就可以了执行chmod u+x *.sh在此执行,OK了 Tomcat无法访问项目404的原因可能是防火墙的原因也有可能是项目的jdk版本与linux的jdk版本不一致开启防火墙开启防火墙(systemctl start firewalld)1.使用命令 firewall-cmd --state查看防火墙状态。得到结果是running或者not running2.为running 时,向firewall 添加需要开放的端口命令为firewall-cmd --permanent --zone=public --add-port=8080/tcp//永久的添加该端口。去掉--permanent则表示临时。4.firewall-cmd --reload//加载配置,使得修改有效。5.使用命令firewall-cmd --permanent --zone=public --list-ports//查看开启的端口,出现8080/tcp这开启正确6.再次使用外部浏览器访问,这出现tomcat的欢迎界面。 安装mysql (其他方法)一、系统环境yum update升级以后的系统版本为[root@yl-web yl]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core)二、mysql安装一般网上给出的资料都是#yum install mysql #yum install mysql-server #yum install mysql-devel安装mysql和mysql-devel都成功,但是安装mysql-server失败,如下:[root@yl-web yl]# yum install mysql-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.sina.cn * extras: mirrors.sina.cn * updates: mirrors.sina.cn No package mysql-server available. Error: Nothing to do查资料发现是CentOS 7 版本将MySQL数据库软件从默认的程序列表中移除,用mariadb代替了。有两种解决办法:1、方法一:安装mariadbMariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。安装mariadb,大小59 M。[root@yl-web yl]# yum install mariadb-server mariadbmariadb数据库的相关命令是:systemctl start mariadb #启动MariaDBsystemctl stop mariadb #停止MariaDBsystemctl restart mariadb #重启MariaDBsystemctl enable mariadb #设置开机启动所以先启动数据库[root@yl-web yl]# systemctl start mariadb然后就可以正常使用mysql了[root@yl-web yl]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 5.5.41-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec) MariaDB [(none)]>安装mariadb后显示的也是 MariaDB [(none)]> ,可能看起来有点不习惯。下面是第二种方法。2、方法二:官网下载安装mysql-server# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm # rpm -ivh mysql-community-release-el7-5.noarch.rpm # yum install mysql-community-server安装成功后重启mysql服务。# service mysqld restart初次安装mysql,root账户没有密码。[root@yl-web yl]# mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.6.26 MySQL Community Server (GPL) Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.01 sec) mysql>设置密码mysql> set password for 'root'@'localhost' =password('password'); Query OK, 0 rows affected (0.00 sec) mysql>不需要重启数据库即可生效。在mysql安装过程中如下内容:Installed: mysql-community-client.x86_64 0:5.6.26-2.el7 mysql-community-devel.x86_64 0:5.6.26-2.el7 mysql-community-libs.x86_64 0:5.6.26-2.el7 mysql-community-server.x86_64 0:5.6.26-2.el7 Dependency Installed: mysql-community-common.x86_64 0:5.6.26-2.el7 Replaced: mariadb.x86_64 1:5.5.41-2.el7_0 mariadb-devel.x86_64 1:5.5.41-2.el7_0 mariadb-libs.x86_64 1:5.5.41-2.el7_0 mariadb-server.x86_64 1:5.5.41-2.el7_0所以安装完以后mariadb自动就被替换了,将不再生效。[root@yl-web yl]# rpm -qa |grep mariadb [root@yl-web yl]#三、配置mysql1、编码mysql配置文件为/etc/my.cnf最后加上编码配置[mysql] default-character-set =utf8这里的字符编码必须和/usr/share/mysql/charsets/Index.xml中一致。2、远程连接设置把在所有数据库的所有表的所有权限赋值给位于所有IP地址的root用户。mysql> grant all privileges on *.* to root@'%'identified by 'password';如果是新用户而不是root,则要先新建用户mysql>create user 'username'@'%' identified by 'password';此时就可以进行远程连接了。如果是连接服务器上的mysql记得配置安全组安装mysql转自https://www.cnblogs.com/starof/p/4680083.html
2021年12月08日
257 阅读
0 评论
0 点赞
2021-12-08
Centos忘记mysql密码
1.vi /etc/my.cnf2.在里面添加 skip-grant-tables例如:[mysqld]skip-grant-tablesdatadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock3.重启mysql service mysql restart4.登录mysql -uroot -p (直接点击回车,密码为空)5.选择数据库use mysql;6.修改root密码update user set authentication_string=password('password') where user='root';7.执行 刷新权限 flush privileges;8.退出exit;9.删除skip-grant-tables10.重启mysqlservice mysql restart再次登录就可以用密码了
2021年12月08日
145 阅读
0 评论
0 点赞
2021-12-08
Centos7 yum 安装redis
centos7 yum安装配置redis 并设置密码centos7 yum安装配置redis 并设置密码 1.设置Redis的仓库地址yum install epel-release2.安装redisyum install redis 修改配置文件,监听所有的IP地址vim /etc/redis.conf 找到下面这一行 bind 127.0.0.1 注释掉 #bind 127.0.0.1 修改redis的守护进程为no ,不启用 127.0.0.1:6379> config set daemonize "no" OK 修改redis的保护模式为no,不启用 127.0.0.1:6379> config set protected-mode "no" OK 3.启动redis,到此完成cd usr/bin 命令目录 ./redis-server 启动服务 ./redis-cli 启动客户端 如果需要设置开机自动启动 chkconfig redis on如果需要redis配置认证密码1.通过配置文件进行配置yum方式安装的redis配置文件通常在/etc/redis.conf中,打开配置文件找到#requirepass foobared去掉行前的注释,并修改密码为所需的密码,保存文件requirepass youpwd通过命令设置密码127.0.0.1:6379> config set requirepass youpassword OK设置密码后就可以通过redis连接工具远程连接了查看redis安装目录rpm -ql redis
2021年12月08日
197 阅读
0 评论
0 点赞
2021-12-08
Centos配置Nginx+tomcat
1.安装1.1安装gcc gcc-c++(如新环境,未安装请先安装)$ yum install -y gcc gcc-c++1.2安装PCRE库$ cd /usr/local/ $ wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz $ tar -zxvf pcre-8.36.tar.gz $ cd pcre-8.36 $ ./configure $ make && make install 如报错:configure: error: You need a C++ compiler for C++ support 解决:yum install -y gcc gcc-c++ 1.3安装SSL库$ cd /usr/local/ $ wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz $ tar -zxvf openssl-1.0.1j.tar.gz $ cd openssl-1.0.1j $ ./config $ make && make install 1.4安装zlib库存$ cd /usr/local/ $ wget http://zlib.net/zlib-1.2.11.tar.gz $ tar -zxvf zlib-1.2.11.tar.gz $ cd zlib-1.2.11 $ ./configure $ make && make install1.5安装nginx$ cd /usr/local/ $ wget http://nginx.org/download/nginx-1.8.0.tar.gz $ tar -zxvf nginx-1.8.0.tar.gz $ cd nginx-1.8.0 $ ./configure --user=nobody --group=nobody --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module make && make install 1.6启动$ /usr/local/nginx/sbin/nginx启动:nginx 停止:nginx -s stop 重新加载: nginx -s reload打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。其他部分命令:$ pkill nginx # 强制关闭 /usr/local/nginx/sbin/nginx -s reload # 重新载入配置文件 /usr/local/nginx/sbin/nginx -s reopen # 重启 Nginx /usr/local/nginx/sbin/nginx -s stop # 停止 Nginx 2.配置tomcat在服务器上配置tomcatA和tomcatB。将两个tomcat的端口改成不一样的,确保没有被占用,然后添加开放端口和配置服务器安全组。修改tomcatA配置conf/server.xml<?xml version="1.0" encoding="UTF-8"?> <Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> <!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> --> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> </Engine> </Service> </Server> 修改tomcatB配置conf/server.xml<?xml version="1.0" encoding="UTF-8"?> <Server port="8006" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> <!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> --> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <Service name="Catalina"> <Connector port="8090" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8444" /> <Connector port="8010" protocol="AJP/1.3" redirectPort="8444" /> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> </Engine> </Service> </Server> 启动tomcatA和tomcatB启动报错 3.使用Nginx和tomcat做负载均衡 3.1修改Nginx文件conf/nginx.conf upstream test { server 127.0.0.1:8080; server 127.0.0.1:8090; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; proxy_pass http://test; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } 3.2 启动启动tomcatA和tongcatB,加载配置文件,启动Nginx 3.3测试
2021年12月08日
270 阅读
0 评论
0 点赞
2021-12-08
Centos7安装ActiveMQ
安装ActiveMQ之前先安装JDK:jdk安装1.创建activemq文件夹[root@izwz91m0zmp2dk7b4n7afiz ~]# cd /home [root@izwz91m0zmp2dk7b4n7afiz home]# mkdir acticemq 查看:[root@izwz91m0zmp2dk7b4n7afiz home]# ls acticemq 2.下载压缩包[root@izwz91m0zmp2dk7b4n7afiz home]# cd activemq [root@izwz91m0zmp2dk7b4n7afiz activemq]# wget http://archive.apache.org/dist/activemq/5.14.5/apache-activemq-5.14.5-bin.tar.gz 3.解压[root@izwz91m0zmp2dk7b4n7afiz activemq]# ls apache-activemq-5.14.5-bin.tar.gz [root@izwz91m0zmp2dk7b4n7afiz activemq]# tar -zxvf apache-activemq-5.14.5-bin.tar.gz 4.查看下载后的文件,修改文件名[root@izwz91m0zmp2dk7b4n7afiz activemq]# ls apache-activemq-5.14.5 apache-activemq-5.14.5-bin.tar.gz [root@izwz91m0zmp2dk7b4n7afiz activemq]# mv apache-activemq-5.14.5 activemq 5.进入bin目录,启动activemq[root@izwz91m0zmp2dk7b4n7afiz activemq]# cd activemq [root@izwz91m0zmp2dk7b4n7afiz activemq]# ls LICENSE NOTICE README.txt activemq-all-5.14.5.jar bin conf data docs examples lib webapps webapps-demo [root@izwz91m0zmp2dk7b4n7afiz activemq]# cd bin [root@izwz91m0zmp2dk7b4n7afiz bin]# ls activemq activemq-diag activemq.jar env linux-x86-32 linux-x86-64 macosx wrapper.jar [root@izwz91m0zmp2dk7b4n7afiz bin]# ./activemq start 查看进程:[root@izwz91m0zmp2dk7b4n7afiz bin]# ps -ef| grep activemq开放端口:添加端口→加载生效→查看[root@izwz91m0zmp2dk7b4n7afiz bin]# firewall-cmd --zone=public --add-port=8161/tcp --permanent success [root@izwz91m0zmp2dk7b4n7afiz bin]# firewall-cmd --zone=public --add-port=61616/tcp --permanent success [root@izwz91m0zmp2dk7b4n7afiz bin]# firewall-cmd --reload success [root@izwz91m0zmp2dk7b4n7afiz bin]# firewall-cmd --zone=public --list-ports 8161/tcp 61616/tcp (如果是云服务器记得在安全组添加服务器的端口,否则访问不了)6.登录验证http://ip地址:8161/admin 用户名:admin 密码:admin 至此安装成功
2021年12月08日
220 阅读
0 评论
0 点赞
2021-12-08
Centos7 安装RabbitMQ及配置(亲测)
Rabbit MQ Linux 安装Centos7如果是重装先把erlang和rabbitmq卸载干净,不然还会重装失败《rabbitmq和erlang卸载》记得删除/var/lib/rabbitmq目录和/etc/rabbitmq目录1 erlang安装1.1 安装依赖环境C++编译yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC unixODBC-devel httpd python-simplejson1.2 erlang语言环境的安装wget http://erlang.org/download/otp_src_21.3.tar.gz 1.3 解压erlang安装包tar -xzvf otp_src_21.3.tar.gz 1.4 进入目录cd otp_src_21.31.5 配置./configure --prefix=/usr/local/erlang --with-ssl -enable-threads -enable-smmp-support -enable-kernel-poll --enable-hipe --without-javac1.6 开始安装编译make make install1.7 配置erlang环境变量在原有的PATH后面添加:/usr/local/erlang/binvim /etc/profile export PATH=$PATH:/usr/local/erlang/bin source /etc/profile #使其生效 echo $PATH1.8 检查erl2. RabbitMQ安装 2.1下载切换目录,把rabbitmq下载到此目录,这里安装的版本是:rabbitmq-server-generic-unix-3.7.9.tarcd /usr/local 2.2 解压tar -xvf rabbitmq-server-generic-unix-3.7.9.tar2.3 配置首先重命名mv rabbitmq_server-3.7.9/ rabbitmqvi /etc/profile #set rabbitmq environment export PATH=$PATH:/usr/local/rabbitmq/sbin source /etc/profile #使其生效 echo $PATH2.4 启动服务rabbitmq-server -detached //启动rabbitmq,-detached代表后台守护进程方式启动。 启动后可能提示Warning: PID file not written; -detached was passed.但是通过浏览器是可以访问的如果启动失败,查看是否端口:5672被占用netstat -lnp|grep 5672 #检查端口被哪个进程占用 ps 762 #查看进程的详细信息,加入进程号是762 kill -9 762 #杀掉编号为762的进程(请根据实际情况输入)2.5 查看状态rabbitmqctl status启动成功如下:2.6 配置网页插件创建目录mkdir /etc/rabbitmq启用插件rabbitmq-plugins enable rabbitmq_management2.7 开放防火墙端口//永久的添加该端口。去掉--permanent则表示临时。 firewall-cmd --permanent --zone=public --add-port=5672/tcp firewall-cmd --permanent --zone=public --add-port=15672/tcp //重新加载配置,使得修改有效。 firewall-cmd --reload //查看开启的端口,出现5672/15672这开启正确 firewall-cmd --permanent --zone=public --list-ports 2.8 相关命令启动服务:rabbitmq-server -detached 查看状态:rabbitmqctl status 关闭服务:rabbitmqctl stop 列出角色:rabbitmqctl list_users2.9 配置账户默认网页是不允许访问的,需要增加一个用户修改一下权限,代码如下:rabbitmqctl add_user username password //添加用户,后面两个参数分别是用户名和密码 rabbitmqctl set_permissions -p / username ".*" ".*" ".*" //添加权限 rabbitmqctl set_user_tags username administrator //修改用户角色2.10 访问浏览器输入:http://ip:15672登录之后到这rabbitmq的安装就完成啦
2021年12月08日
170 阅读
0 评论
0 点赞
2021-12-08
centos安装mosquitto支持websocket
下载libwebsocketshttps://github.com/warmcat/libwebsockets/archive/v1.5-chrome47-firefox41.tar.gz安装基础软件yum install gcc-c++ yum install cmake yum install openssl-devel //mosquitto默认支持openssl解压、编译、安装libwebsockets tar zxvf libwebsockets-1.5-chrome47-firefox41.tar.gz cd libwebsockets-1.5-chrome47-firefox41 mkdir build cd build cmake .. make make install安装mosquittoyum install mosquitto修改配置文件mv /etc/mosquitto/mosquitto.conf.example /etc/mosquitto/mosquitto.conf# ================================================================= # General configuration # ================================================================= # 客户端心跳的间隔时间 #retry_interval 20 # 系统状态的刷新时间 #sys_interval 10 # 系统资源的回收时间,0表示尽快处理 #store_clean_interval 10 # 服务进程的PID #pid_file /var/run/mosquitto.pid # 服务进程的系统用户 user root # 客户端心跳消息的最大并发数 #max_inflight_messages 10 # 客户端心跳消息缓存队列 #max_queued_messages 100 # 用于设置客户端长连接的过期时间,默认永不过期 #persistent_client_expiration # ================================================================= # Default listener # ================================================================= # 服务绑定的IP地址 #bind_address # 服务绑定的端口号 port 1883 listener 9001 protocol websockets # 允许的最大连接数,-1表示没有限制 #max_connections -1 # cafile:CA证书文件 # capath:CA证书目录 # certfile:PEM证书文件 # keyfile:PEM密钥文件 #cafile #capath #certfile #keyfile # 必须提供证书以保证数据安全性 #require_certificate false # 若require_certificate值为true,use_identity_as_username也必须为true #use_identity_as_username false # 启用PSK(Pre-shared-key)支持 #psk_hint # SSL/TSL加密算法,可以使用“openssl ciphers”命令获取 # as the output of that command. #ciphers # ================================================================= # Persistence # ================================================================= # 消息自动保存的间隔时间 #autosave_interval 1800 # 消息自动保存功能的开关 #autosave_on_changes false # 持久化功能的开关 persistence true # 持久化DB文件 #persistence_file mosquitto.db # 持久化DB文件目录 #persistence_location /var/lib/mosquitto/ # ================================================================= # Logging # ================================================================= # 4种日志模式:stdout、stderr、syslog、topic # none 则表示不记日志,此配置可以提升些许性能 log_dest none # 选择日志的级别(可设置多项) #log_type error #log_type warning #log_type notice #log_type information # 是否记录客户端连接信息 #connection_messages true # 是否记录日志时间 #log_timestamp true # ================================================================= # Security # ================================================================= # 客户端ID的前缀限制,可用于保证安全性 #clientid_prefixes # 允许匿名用户 allow_anonymous false # 用户/密码文件,默认格式:username:password password_file /etc/mosquitto/pwfile.example # PSK格式密码文件,默认格式:identity:key #psk_file # pattern write sensor/%u/data # ACL权限配置,常用语法如下: # 用户限制:user <username> # 话题限制:topic [read|write] <topic> # 正则限制:pattern write sensor/%u/data # 配置topic和用户 acl_file /etc/mosquitto/aclfile # ================================================================= # Bridges # ================================================================= # 允许服务之间使用“桥接”模式(可用于分布式部署) #connection <name> #address <host>[:<port>] #topic <topic> [[[out | in | both] qos-level] local-prefix remote-prefix] # 设置桥接的客户端ID #clientid # 桥接断开时,是否清除远程服务器中的消息 #cleansession false # 是否发布桥接的状态信息 #notifications true # 设置桥接模式下,消息将会发布到的话题地址 # $SYS/broker/connection/<clientid>/state #notification_topic # 设置桥接的keepalive数值 #keepalive_interval 60 # 桥接模式,目前有三种:automatic、lazy、once #start_type automatic # 桥接模式automatic的超时时间 #restart_timeout 30 # 桥接模式lazy的超时时间 #idle_timeout 60 # 桥接客户端的用户名 #username # 桥接客户端的密码 #password # bridge_cafile:桥接客户端的CA证书文件 # bridge_capath:桥接客户端的CA证书目录 # bridge_certfile:桥接客户端的PEM证书文件 # bridge_keyfile:桥接客户端的PEM密钥文件 #bridge_cafile #bridge_capath #bridge_certfile #bridge_keyfile修改文件mv /etc/mosquitto/aclfile.example /etc/mosquitto/aclfileuser test topic read test/# topic write test/# # This affects access control for clients with no username. topic read $SYS/# # This only affects clients with username "roger". user roger topic foo/bar # This affects all clients. pattern write $SYS/broker/connection/%c/state配置用户名和密码groupadd mosquitto useradd -g mosquitto mosquitto添加启动用户(默认mosquitto用户启动)groupadd mosquitto useradd -g mosquitto mosquitto后台启动mosquitto -c /etc/mosquitto/mosquitto.conf -d如果报错查看命令所在目录find / -name mosquitto复制命令到对应文件夹cp mosquitto /usr/local/sbin/
2021年12月08日
168 阅读
0 评论
0 点赞
2021-12-08
linux启动tomcat报Permission denied
在tomcat路径下执行./startup.sh或者执行./shutdown.sh报出Permission denied无法执行,是因为用户没有权限在当前目录下执行 用命令chmod 修改一下bin目录下的.sh权限就可以了执行 chmod u+x *.sh 就可以了
2021年12月08日
300 阅读
0 评论
0 点赞
1
...
3
4
5
6