6月30
在做javaweb项目时,关于统一错误页面在开发的过程中就做过编码,并且一直都很有效,像500,404,403等常规错误码都能得到有效处理,但是400却不行,而且还暴露tomcat的版本信息,这是很严重的安全漏洞
解决方法百度和测试很多,总结如下:
问题产生:
根据rfc规范,url中不允许有 |,{,}等特殊字符,但在实际生产中还是有些url有可能携带有这些字符,特别是|还是较为常见的。在tomcat升级到7以后,对url字符的检查都变严格了,如果出现这类字符,服务器tomcat将直接返回400状态码。
方法一:降低tomcat的版本
开发人员增加一项设置,允许配置在url可以出现的特殊字符,但也仅限于|,{,}三种,见:http://tomcat.apache.org/tomcat-8.0-doc/config/systemprops.html#Other
该项设置在以下版本的tomcat中有效:
- 8.5.x for 8.5.12 onwards
- 8.0.x for 8.0.42 onwards
- 7.0.x for 7.0.76 onwards
- 这个只是允许出现一些特殊字符,并没有说是全部特殊字符。
好像是tomcat7.9以上的版本,都不支持请求链接上带有特殊字符.否则会报400错误,
tomcat请求中包含特殊字符 [] | {} 发送get请求失败:
原因:
这是因为Tomcat严格按照 RFC 3986规范进行访问解析,而 RFC 3986规范定义了Url中只允许包含英文字母(a-zA-Z)、数字(0-9)、-_.~4个特殊字符以及所有保留字符(RFC3986中指定了以下字符为保留字符:! * ’ ( ) ; : @ & = + $ , / ? # [ ])。传入的参数中有"[]"、""不在RFC3986中的保留字段中,所以会报这个错。
方法二:修改server.xml
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" relaxedQueryChars="[]|{}^\`"<>" redirectPort="8443" />
方法三:修改server.xml(推荐方法)
在Host里加入:
<Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false" />
方法三 修改后只会显示出HTTP 400 错误,不会打印堆栈和tomcat版本号信息
解决方法百度和测试很多,总结如下:
问题产生:
根据rfc规范,url中不允许有 |,{,}等特殊字符,但在实际生产中还是有些url有可能携带有这些字符,特别是|还是较为常见的。在tomcat升级到7以后,对url字符的检查都变严格了,如果出现这类字符,服务器tomcat将直接返回400状态码。
方法一:降低tomcat的版本
开发人员增加一项设置,允许配置在url可以出现的特殊字符,但也仅限于|,{,}三种,见:http://tomcat.apache.org/tomcat-8.0-doc/config/systemprops.html#Other
该项设置在以下版本的tomcat中有效:
- 8.5.x for 8.5.12 onwards
- 8.0.x for 8.0.42 onwards
- 7.0.x for 7.0.76 onwards
- 这个只是允许出现一些特殊字符,并没有说是全部特殊字符。
好像是tomcat7.9以上的版本,都不支持请求链接上带有特殊字符.否则会报400错误,
tomcat请求中包含特殊字符 [] | {} 发送get请求失败:
原因:
这是因为Tomcat严格按照 RFC 3986规范进行访问解析,而 RFC 3986规范定义了Url中只允许包含英文字母(a-zA-Z)、数字(0-9)、-_.~4个特殊字符以及所有保留字符(RFC3986中指定了以下字符为保留字符:! * ’ ( ) ; : @ & = + $ , / ? # [ ])。传入的参数中有"[]"、""不在RFC3986中的保留字段中,所以会报这个错。
方法二:修改server.xml
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" relaxedQueryChars="[]|{}^\`"<>" redirectPort="8443" />
方法三:修改server.xml(推荐方法)
在Host里加入:
<Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false" />
方法三 修改后只会显示出HTTP 400 错误,不会打印堆栈和tomcat版本号信息
6月29
linux同步时间命令:
1、hwclock命令,可以让系统时间和硬件时间的同步,例“hwclock -w”或“hwclock -s”;
2、ntpdate命令,可以让不同机器间同步时间。
在Windwos中,系统时间的设置很简单,界面操作,通俗易懂,而且设置后,重启,关机都没关系。系统时间会自动保存在BIOS时钟里面,启动计算机的时候,系统会自动在BIOS里面取硬件时间,以保证时间的不间断。
但在Linux下,默认情况下,系统时间和硬件时间并不会自动同步。在Linux运行过程中,系统时间和硬件时间以异步的方式运行,互不干扰。硬件时间的运行,是靠BIOS电池来维持,而系统时间,是用CPU Tick来维持的。在系统开机的时候,会自动从BIOS中取得硬件时间,设置为系统时间。
1. Linux系统时间的设置
在Linux中设置系统时间,可以用date命令:
//查看时间
[root@node1 ~]# date
Tue Feb 25 20:15:18 CST 2014
//修改时间
[root@node1 ~]# date -s "20140225 20:16:00" #yyyymmdd hh:mm:ss
Tue Feb 25 20:16:00 CST 2014
//date 有多种时间格式可接受,查看date --help
2. Linux硬件时间的设置
硬件时间的设置,可以用hwclock或者clock命令。两者基本相同,只用一个就行,只不过clock命令除了支持x86硬件体系外,还支持Alpha硬件体系。
//查看硬件时间可以是用hwclock ,hwclock --show 或者 hwclock -r
[root@node1 ~]# hwclock --show
Tue 25 Feb 2014 08:21:14 PM CST -0.327068 seconds
//设置硬件时间
[root@node1 ~]# hwclock --set --date "20140225 20:23:00"
[root@node1 ~]# hwclock
Tue 25 Feb 2014 08:23:04 PM CST -0.750440 seconds
3. 系统时间和硬件时间的同步
同步系统时间和硬件时间,可以使用hwclock命令。
//以系统时间为基准,修改硬件时间
[root@node1 ~]# hwclock --systohc <== sys(系统时间)to(写到)hc(Hard Clock)
//或者
[root@node1 ~]# hwclock -w
//以硬件时间为基准,修改系统时间
[root@node1 ~]# hwclock --hctosys
//或者
[root@node1 ~]# hwclock -s
1、hwclock命令,可以让系统时间和硬件时间的同步,例“hwclock -w”或“hwclock -s”;
2、ntpdate命令,可以让不同机器间同步时间。
在Windwos中,系统时间的设置很简单,界面操作,通俗易懂,而且设置后,重启,关机都没关系。系统时间会自动保存在BIOS时钟里面,启动计算机的时候,系统会自动在BIOS里面取硬件时间,以保证时间的不间断。
但在Linux下,默认情况下,系统时间和硬件时间并不会自动同步。在Linux运行过程中,系统时间和硬件时间以异步的方式运行,互不干扰。硬件时间的运行,是靠BIOS电池来维持,而系统时间,是用CPU Tick来维持的。在系统开机的时候,会自动从BIOS中取得硬件时间,设置为系统时间。
1. Linux系统时间的设置
在Linux中设置系统时间,可以用date命令:
//查看时间
[root@node1 ~]# date
Tue Feb 25 20:15:18 CST 2014
//修改时间
[root@node1 ~]# date -s "20140225 20:16:00" #yyyymmdd hh:mm:ss
Tue Feb 25 20:16:00 CST 2014
//date 有多种时间格式可接受,查看date --help
2. Linux硬件时间的设置
硬件时间的设置,可以用hwclock或者clock命令。两者基本相同,只用一个就行,只不过clock命令除了支持x86硬件体系外,还支持Alpha硬件体系。
//查看硬件时间可以是用hwclock ,hwclock --show 或者 hwclock -r
[root@node1 ~]# hwclock --show
Tue 25 Feb 2014 08:21:14 PM CST -0.327068 seconds
//设置硬件时间
[root@node1 ~]# hwclock --set --date "20140225 20:23:00"
[root@node1 ~]# hwclock
Tue 25 Feb 2014 08:23:04 PM CST -0.750440 seconds
3. 系统时间和硬件时间的同步
同步系统时间和硬件时间,可以使用hwclock命令。
//以系统时间为基准,修改硬件时间
[root@node1 ~]# hwclock --systohc <== sys(系统时间)to(写到)hc(Hard Clock)
//或者
[root@node1 ~]# hwclock -w
//以硬件时间为基准,修改系统时间
[root@node1 ~]# hwclock --hctosys
//或者
[root@node1 ~]# hwclock -s
4月18
今天遇到的问题是jdk1.8_291The server selected protocol version TLS10 is not accepted by client preferences [TLS12]
配置的是jdk1.8_291
之前一直用的jdk1.8_191没有遇到连接sqlserver数据库错误的问题,今天遇到了就各种百度查原因,大概都是说新版本不支持TLS10
解决方案:
根据环境变量配置中 jre 的地址,在 jre\lib\security 文件夹下,编辑 java.security 文件
在文件中找到 jdk.tls.disabledAlgorithms 配置项,将 TLSv1, TLSv1.1, 3DES_EDE_CBC 删除即可。
修改后:
jdk.tls.disabledAlgorithms=SSLv3,RC4, DES, MD5withRSA,
DH keySize < 1024, EC keySize < 224, anon, NULL,
include jdk.disabled.namedCurves
我试着修改了,但是不起作用,以为要重启,连电脑我都重启了,还是不起作用,最后!!!
重点来了!!修改的是jdk下的jre里面的lib\security 文件夹下的 java.security 文件!!!我的目录是:D:\Java\jdk1.8.0_291\jre\lib\security(改这个文件下面的才有效!!!)
之前没生效是因为我改的是直接jre下的lib\security 文件夹下的 java.security文件
jre目录是:D:\Java\jre1.8.0_291\lib\security(这个没用,改了完全不起作用)
花了好几个小时终于不再报错,留个记录,警醒自己,当然如果能帮到你们就更好啦~
配置的是jdk1.8_291
之前一直用的jdk1.8_191没有遇到连接sqlserver数据库错误的问题,今天遇到了就各种百度查原因,大概都是说新版本不支持TLS10
解决方案:
根据环境变量配置中 jre 的地址,在 jre\lib\security 文件夹下,编辑 java.security 文件
在文件中找到 jdk.tls.disabledAlgorithms 配置项,将 TLSv1, TLSv1.1, 3DES_EDE_CBC 删除即可。
修改后:
jdk.tls.disabledAlgorithms=SSLv3,RC4, DES, MD5withRSA,
DH keySize < 1024, EC keySize < 224, anon, NULL,
include jdk.disabled.namedCurves
我试着修改了,但是不起作用,以为要重启,连电脑我都重启了,还是不起作用,最后!!!
重点来了!!修改的是jdk下的jre里面的lib\security 文件夹下的 java.security 文件!!!我的目录是:D:\Java\jdk1.8.0_291\jre\lib\security(改这个文件下面的才有效!!!)
之前没生效是因为我改的是直接jre下的lib\security 文件夹下的 java.security文件
jre目录是:D:\Java\jre1.8.0_291\lib\security(这个没用,改了完全不起作用)
花了好几个小时终于不再报错,留个记录,警醒自己,当然如果能帮到你们就更好啦~
3月20
redis读取数据失败,打印异常信息如下:
Could not read JSON: Invalid UTF-32 character 0x22636364 (above 0x0010ffff) at char #15, byte #63); nested exception is java.io.CharConversionException: Invalid UTF-32 character 0x22636364 (above 0x0010ffff) at char #15, byte #63)
问题的原因是我在添加数据时设置了存活时间但是忘记指定单位了;
正确的应该是再指定TimeUnit.SECONDS参数。
时间单位:
天:TimeUnit.DAYS
小时:TimeUnit.HOURS
分钟:TimeUnit.MINUTES
秒:TimeUnit.SECONDS
毫秒:TimeUnit.MILLISECONDS
Could not read JSON: Invalid UTF-32 character 0x22636364 (above 0x0010ffff) at char #15, byte #63); nested exception is java.io.CharConversionException: Invalid UTF-32 character 0x22636364 (above 0x0010ffff) at char #15, byte #63)
问题的原因是我在添加数据时设置了存活时间但是忘记指定单位了;
正确的应该是再指定TimeUnit.SECONDS参数。
时间单位:
天:TimeUnit.DAYS
小时:TimeUnit.HOURS
分钟:TimeUnit.MINUTES
秒:TimeUnit.SECONDS
毫秒:TimeUnit.MILLISECONDS
3月17
下面列举下EasyPoi支持的指令以及作用,最主要的就是各种fe的用法文字
三元运算 {{test ? obj:obj2}}
n: 表示 这个cell是数值类型 {{n:}}
le: 代表长度{{le:()}} 在if/else 运用{{le:() > 8 ? obj1 : obj2}}
fd: 格式化时间 {{fd:(obj;yyyy-MM-dd)}}
fn: 格式化数字 {{fn:(obj;###.00)}}
fe: 遍历数据,创建row
!fe: 遍历数据不创建row
$fe: 下移插入,把当前行,下面的行全部下移.size()行,然后插入
#fe: 横向遍历
v_fe: 横向遍历值
!if: 删除当前列 {{!if:(test)}}
单引号表示常量值 ‘’ 比如’1’ 那么输出的就是 1
&NULL& 空格
&INDEX& 表示循环中的序号,自动添加,看到这里应该就明白怎么在表格中增加一列序号了。
]] 换行符 多行遍历导出
sum: 统计数据
三元运算 {{test ? obj:obj2}}
n: 表示 这个cell是数值类型 {{n:}}
le: 代表长度{{le:()}} 在if/else 运用{{le:() > 8 ? obj1 : obj2}}
fd: 格式化时间 {{fd:(obj;yyyy-MM-dd)}}
fn: 格式化数字 {{fn:(obj;###.00)}}
fe: 遍历数据,创建row
!fe: 遍历数据不创建row
$fe: 下移插入,把当前行,下面的行全部下移.size()行,然后插入
#fe: 横向遍历
v_fe: 横向遍历值
!if: 删除当前列 {{!if:(test)}}
单引号表示常量值 ‘’ 比如’1’ 那么输出的就是 1
&NULL& 空格
&INDEX& 表示循环中的序号,自动添加,看到这里应该就明白怎么在表格中增加一列序号了。
]] 换行符 多行遍历导出
sum: 统计数据
3月8
1、前端封装JSON值,后台需要List<实体类>接收
Map map = jsonObject.getInnerMap();
List<RecommendDTO> recommendDTOlist = (List<RecommendDTO>) map.get("xxx");
2、进行forearch循环的时候报错
recommendDTOlist .forEach((item)->{})
3、从redis中获取数据后进行遍历
List<RecommendDTO> recommendDTOlist = redisUtil.get(defaultCacheKey);
for (RecommendDTO recommendDTO : defaultRecommendList) {
}
报错信息:
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to com.heckjj.apps.modules.smartpush.dto.RecommendDTO
4、打断点调试查看发现里面封装的是两个Map 而不是实体类而是个LinkedHashMap
5、解决方法
ObjectMapper mapper = new ObjectMapper();
List<RecommendDTO> recommendDTOlist = (List<RecommendDTO>) map.get("xxx");
List<RecommendDTO> recommendDTOlist = mapper.convertValue(list1, new TypeReference<List<RecommendDTO>>() { });
记住引入包路径是下面这两个
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
Map map = jsonObject.getInnerMap();
List<RecommendDTO> recommendDTOlist = (List<RecommendDTO>) map.get("xxx");
2、进行forearch循环的时候报错
recommendDTOlist .forEach((item)->{})
3、从redis中获取数据后进行遍历
List<RecommendDTO> recommendDTOlist = redisUtil.get(defaultCacheKey);
for (RecommendDTO recommendDTO : defaultRecommendList) {
}
报错信息:
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to com.heckjj.apps.modules.smartpush.dto.RecommendDTO
4、打断点调试查看发现里面封装的是两个Map 而不是实体类而是个LinkedHashMap
5、解决方法
ObjectMapper mapper = new ObjectMapper();
List<RecommendDTO> recommendDTOlist = (List<RecommendDTO>) map.get("xxx");
List<RecommendDTO> recommendDTOlist = mapper.convertValue(list1, new TypeReference<List<RecommendDTO>>() { });
记住引入包路径是下面这两个
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
2月28
使用Easticsearc时侯启动时,点击elasticsearch.bat发生闪退。
原因:允许elasticsearch跨越访问时,在修改了elasticsearch的配置文件,并且以非UTF-8的格式修改的,结果就报错了。
添加跨域访问:
http.cors.enabled: true
http.cors.allow‐origin: "*"
日志:
java.lang.IllegalArgumentException:unknown setting [http.cors.allow‐origin] did you mean [http.cors.allow-origin]?
问题:查看日志文件可以看出allowe-origin中的符号没有识别。
解决:原因是在修改elasticsearch.yml时用的notepad++,默认的是ANSI 编码,重新修改配置文件,以UTF-8编码修改并保存。(注意:修改elasticsearch.yml最好只用utf-8编码)
elasticsearch:6.2.1
jdk:1.8.0.241 [ java -version]
我的elasticsearch.yml 配置 ,如下:
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
##配置elasticsearch的集群名称,默认是elasticsearch。建议修改成一个有意义的名称。
cluster.name: lxw-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
##节点名,通常一台物理服务器就是一个节点,es会默认随机指定一个名字,建议指定一个有意义的名称,方便管理
node.name: lxw-node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
node.master: true #主节点
node.data: true #数据节点
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#索引目录
path.data: D:\softwore\elasticsearch-6.2.1\data
# Path to log files:
#日志
path.logs: D:\softwore\elasticsearch-6.2.1\logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
##绑定ip地址 我的问题是改的这里
#network.host: 0.0.0.0
network.host: 127.0.0.1
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#暴露的http端口
http.port: 9200
#内部端口
transport.tcp.port: 9300
# 跨域设置
http.cors.enabled: true
http.cors.allow-origin: "*"
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
#设置集群中master节点的初始列表
discovery.zen.ping.unicast.hosts: ["0.0.0.0:9300", "0.0.0.0:9301", "0.0.0.0:9302"]
#主结点数量的最少值 ,此值的公式为:(master_eligible_nodes / 2) + 1 ,比如:有3个符合要求的主结点,那么这里要设置为2。
discovery.zen.minimum_master_nodes: 1
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
报错如下:
D:\softwore\elasticsearch-6.2.1\bin>elasticsearch.bat
[2021-08-16T14:56:26,659][INFO ][o.e.n.Node ] [lxw-node-1] initializing ...
[2021-08-16T14:56:26,753][INFO ][o.e.e.NodeEnvironment ] [lxw-node-1] using [1] data paths, mounts [[(D:)]], net usable_space [380.2gb], net total_space [390.6gb], types [NTFS]
[2021-08-16T14:56:26,754][INFO ][o.e.e.NodeEnvironment ] [lxw-node-1] heap size [990.7mb], compressed ordinary object pointers [true]
[2021-08-16T14:56:26,756][INFO ][o.e.n.Node ] [lxw-node-1] node name [lxw-node-1], node ID [JdIIBJ5NRYSD52RuvkxTiQ]
[2021-08-16T14:56:26,756][INFO ][o.e.n.Node ] [lxw-node-1] version[6.2.1], pid[13648], build[7299dc3/2018-02-07T19:34:26.990113Z], OS[Windows 10/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_241/25.241-b07]
[2021-08-16T14:56:26,757][INFO ][o.e.n.Node ] [lxw-node-1] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=C:\Users\LEJU\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Delasticsearch, -Des.path.home=D:\softwore\elasticsearch-6.2.1, -Des.path.conf=D:\softwore\elasticsearch-6.2.1\config]
[2021-08-16T14:56:27,485][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [aggs-matrix-stats]
[2021-08-16T14:56:27,485][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [analysis-common]
[2021-08-16T14:56:27,493][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [ingest-common]
[2021-08-16T14:56:27,494][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [lang-expression]
[2021-08-16T14:56:27,494][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [lang-mustache]
[2021-08-16T14:56:27,496][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [lang-painless]
[2021-08-16T14:56:27,497][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [mapper-extras]
[2021-08-16T14:56:27,497][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [parent-join]
[2021-08-16T14:56:27,498][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [percolator]
[2021-08-16T14:56:27,498][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [rank-eval]
[2021-08-16T14:56:27,499][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [reindex]
[2021-08-16T14:56:27,499][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [repository-url]
[2021-08-16T14:56:27,500][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [transport-netty4]
[2021-08-16T14:56:27,500][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [tribe]
[2021-08-16T14:56:27,501][INFO ][o.e.p.PluginsService ] [lxw-node-1] no plugins loaded
[2021-08-16T14:56:28,679][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [lxw-node-1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: unknown setting [http.cors.allow‐origin] did you mean [http.cors.allow-origin]?
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.2.1.jar:6.2.1]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.2.1.jar:6.2.1]
Caused by: java.lang.IllegalArgumentException: unknown setting [http.cors.allow鈥恛rigin] did you mean [http.cors.allow-origin]?
at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:346) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:310) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:284) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.common.settings.SettingsModule.<init>(SettingsModule.java:134) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.node.Node.<init>(Node.java:331) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.node.Node.<init>(Node.java:246) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:323) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.2.1.jar:6.2.1]
解决方法:
将原来的:注意版本问题,不同版本兼容性不一样
补充:解决Elasticsearch(Windows)闪退问题
进入Elasticsearch安装目录下的config目录,修改elasticsearch.yml文件.在文件的末尾加入以下代码
http.cors.enabled: true
http.cors.allow-origin: "*"
cluster.name: heck
node.name: master
network.host: 127.0.0.1
发现持续闪退。这时候我一开始只加入前两行的时候,发现可以正常运行。于是推理了一下,其实可以看日志,但是可能我比较懒,直接感觉加的ip绑定有问题,于是删除最后一行,重新保存启动,发现可以正常运行,好像是因为Elasticsearch是跨域的,具体可能是什么问题,没有细查
原因:允许elasticsearch跨越访问时,在修改了elasticsearch的配置文件,并且以非UTF-8的格式修改的,结果就报错了。
添加跨域访问:
http.cors.enabled: true
http.cors.allow‐origin: "*"
日志:
java.lang.IllegalArgumentException:unknown setting [http.cors.allow‐origin] did you mean [http.cors.allow-origin]?
问题:查看日志文件可以看出allowe-origin中的符号没有识别。
解决:原因是在修改elasticsearch.yml时用的notepad++,默认的是ANSI 编码,重新修改配置文件,以UTF-8编码修改并保存。(注意:修改elasticsearch.yml最好只用utf-8编码)
elasticsearch:6.2.1
jdk:1.8.0.241 [ java -version]
我的elasticsearch.yml 配置 ,如下:
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
##配置elasticsearch的集群名称,默认是elasticsearch。建议修改成一个有意义的名称。
cluster.name: lxw-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
##节点名,通常一台物理服务器就是一个节点,es会默认随机指定一个名字,建议指定一个有意义的名称,方便管理
node.name: lxw-node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
node.master: true #主节点
node.data: true #数据节点
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#索引目录
path.data: D:\softwore\elasticsearch-6.2.1\data
# Path to log files:
#日志
path.logs: D:\softwore\elasticsearch-6.2.1\logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
##绑定ip地址 我的问题是改的这里
#network.host: 0.0.0.0
network.host: 127.0.0.1
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#暴露的http端口
http.port: 9200
#内部端口
transport.tcp.port: 9300
# 跨域设置
http.cors.enabled: true
http.cors.allow-origin: "*"
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
#设置集群中master节点的初始列表
discovery.zen.ping.unicast.hosts: ["0.0.0.0:9300", "0.0.0.0:9301", "0.0.0.0:9302"]
#主结点数量的最少值 ,此值的公式为:(master_eligible_nodes / 2) + 1 ,比如:有3个符合要求的主结点,那么这里要设置为2。
discovery.zen.minimum_master_nodes: 1
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
报错如下:
D:\softwore\elasticsearch-6.2.1\bin>elasticsearch.bat
[2021-08-16T14:56:26,659][INFO ][o.e.n.Node ] [lxw-node-1] initializing ...
[2021-08-16T14:56:26,753][INFO ][o.e.e.NodeEnvironment ] [lxw-node-1] using [1] data paths, mounts [[(D:)]], net usable_space [380.2gb], net total_space [390.6gb], types [NTFS]
[2021-08-16T14:56:26,754][INFO ][o.e.e.NodeEnvironment ] [lxw-node-1] heap size [990.7mb], compressed ordinary object pointers [true]
[2021-08-16T14:56:26,756][INFO ][o.e.n.Node ] [lxw-node-1] node name [lxw-node-1], node ID [JdIIBJ5NRYSD52RuvkxTiQ]
[2021-08-16T14:56:26,756][INFO ][o.e.n.Node ] [lxw-node-1] version[6.2.1], pid[13648], build[7299dc3/2018-02-07T19:34:26.990113Z], OS[Windows 10/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_241/25.241-b07]
[2021-08-16T14:56:26,757][INFO ][o.e.n.Node ] [lxw-node-1] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=C:\Users\LEJU\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Delasticsearch, -Des.path.home=D:\softwore\elasticsearch-6.2.1, -Des.path.conf=D:\softwore\elasticsearch-6.2.1\config]
[2021-08-16T14:56:27,485][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [aggs-matrix-stats]
[2021-08-16T14:56:27,485][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [analysis-common]
[2021-08-16T14:56:27,493][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [ingest-common]
[2021-08-16T14:56:27,494][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [lang-expression]
[2021-08-16T14:56:27,494][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [lang-mustache]
[2021-08-16T14:56:27,496][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [lang-painless]
[2021-08-16T14:56:27,497][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [mapper-extras]
[2021-08-16T14:56:27,497][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [parent-join]
[2021-08-16T14:56:27,498][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [percolator]
[2021-08-16T14:56:27,498][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [rank-eval]
[2021-08-16T14:56:27,499][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [reindex]
[2021-08-16T14:56:27,499][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [repository-url]
[2021-08-16T14:56:27,500][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [transport-netty4]
[2021-08-16T14:56:27,500][INFO ][o.e.p.PluginsService ] [lxw-node-1] loaded module [tribe]
[2021-08-16T14:56:27,501][INFO ][o.e.p.PluginsService ] [lxw-node-1] no plugins loaded
[2021-08-16T14:56:28,679][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [lxw-node-1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: unknown setting [http.cors.allow‐origin] did you mean [http.cors.allow-origin]?
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.2.1.jar:6.2.1]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.2.1.jar:6.2.1]
Caused by: java.lang.IllegalArgumentException: unknown setting [http.cors.allow鈥恛rigin] did you mean [http.cors.allow-origin]?
at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:346) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:310) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:284) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.common.settings.SettingsModule.<init>(SettingsModule.java:134) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.node.Node.<init>(Node.java:331) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.node.Node.<init>(Node.java:246) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:323) ~[elasticsearch-6.2.1.jar:6.2.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.2.1.jar:6.2.1]
解决方法:
将原来的:注意版本问题,不同版本兼容性不一样
补充:解决Elasticsearch(Windows)闪退问题
进入Elasticsearch安装目录下的config目录,修改elasticsearch.yml文件.在文件的末尾加入以下代码
http.cors.enabled: true
http.cors.allow-origin: "*"
cluster.name: heck
node.name: master
network.host: 127.0.0.1
发现持续闪退。这时候我一开始只加入前两行的时候,发现可以正常运行。于是推理了一下,其实可以看日志,但是可能我比较懒,直接感觉加的ip绑定有问题,于是删除最后一行,重新保存启动,发现可以正常运行,好像是因为Elasticsearch是跨域的,具体可能是什么问题,没有细查
2月27
Elasticsearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java语言开发的,并作为Apache许可条款下的开放源码发布,是一种流行的企业级搜索引擎。Elasticsearch用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。官方客户端在Java、.NET(C#)、PHP、Python、Apache Groovy、Ruby和许多其他语言中都是可用的。根据DB-Engines的排名显示,Elasticsearch是最受欢迎的企业搜索引擎,其次是Apache Solr,也是基于Lucene。
Download Elasticsearch
https://www.elastic.co/cn/downloads/elasticsearch
因为这里本机已经安装运行,为了演示从零开始,我们在Windows沙盒中演示,Win10操作系统的沙盒http://www.javacui.com/tool/660.html 。
因为沙盒开始是一个纯净的系统,所以需要安装ZIP工具,安装文本编辑工具方便修改配置文件。
这里下载了elasticsearch-8.2.2-windows-x86_64,可以根据网站提示下载最新版本,虽然ES依赖JDK,但是ES安装文件内置了JDK,因为纯净的系统上无需安装再次安装JDK,直接运行bin下elasticsearch.bat即可。
初次启动,显示的配置信息,一定要保存下来,以备使用。
访问https://127.0.0.1:9200,注意是HTTPS不是HTTP,用户名密码刚才控制台已经打印出来了。
证明安装成功。
问题1:内存直接占满
此时你打开任务管理器,发现一个问题,ES启动后,占据了沙盒的全部内存。我的本机是32G的,启动也是直接打满,导致系统卡爆。
因此我们需要配置启动内存,配置文件conf/jvm.options
################################################################
## IMPORTANT: JVM heap size
################################################################
##
## The heap size is automatically configured by Elasticsearch
## based on the available memory in your system and the roles
## each node is configured to fulfill. If specifying heap is
## required, it should be done through a file in jvm.options.d,
## which should be named with .options suffix, and the min and
## max should be set to the same value. For example, to set the
## heap to 4 GB, create a new file in the jvm.options.d
## directory containing these lines:
##
-Xms1g
-Xmx1g
在这里修改为合适的内存,这里修改为1G,沙盒全部内存是4G,合理配置即可。
问题2:二次启动报错
修改配置文件后,再次启动,这时不会再次打印第一次启动时的配置信息了。但是报错了
[2022-06-16T10:40:55,562][ERROR][o.e.i.g.GeoIpDownloader ] [06A8DD4C-A847-4] exception during geoip databases update
org.elasticsearch.ElasticsearchException: not all primary shards of [.geoip_databases] index are active
at org.elasticsearch.ingest.geoip.GeoIpDownloader.updateDatabases(GeoIpDownloader.java:135) ~[ingest-geoip-8.2.2.jar:8.2.2]
at org.elasticsearch.ingest.geoip.GeoIpDownloader.runDownloader(GeoIpDownloader.java:275) [ingest-geoip-8.2.2.jar:8.2.2]
at org.elasticsearch.ingest.geoip.GeoIpDownloaderTaskExecutor.nodeOperation(GeoIpDownloaderTaskExecutor.java:102) [ingest-geoip-8.2.2.jar:8.2.2]
at org.elasticsearch.ingest.geoip.GeoIpDownloaderTaskExecutor.nodeOperation(GeoIpDownloaderTaskExecutor.java:48) [ingest-geoip-8.2.2.jar:8.2.2]
at org.elasticsearch.persistent.NodePersistentTasksExecutor$1.doRun(NodePersistentTasksExecutor.java:42) [elasticsearch-8.2.2.jar:8.2.2]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:773) [elasticsearch-8.2.2.jar:8.2.2]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) [elasticsearch-8.2.2.jar:8.2.2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.lang.Thread.run(Thread.java:833) [?:?]
因为他启动时会去更新地图的一些数据库,这里直接禁掉即可,用到时再说,配置文件conf/elasticsearch.yml,增加配置
ingest.geoip.downloader.enabled: false
问题3:本地测试不想用用户密码和SSL
本身ES服务器也不会对外开放,增加用户密码和SSL对于初学来说,徒增不必要的麻烦,这里直接干掉,还是那句话,用到再说。
配置文件conf/elasticsearch.yml,修改配置
# Enable security features
xpack.security.enabled: false
xpack.security.enrollment.enabled: false
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
enabled: false
keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
enabled: false
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["06A8DD4C-A847-4"]
# Allow HTTP API connections from anywhere
# Connections are encrypted and require user authentication
http.host: 0.0.0.0
# Allow other nodes to join the cluster from anywhere
# Connections are encrypted and mutually authenticated
#transport.host: 0.0.0.0
原来都是true,这里都改成了false,前面是要求用户登录的,后面是要求SSL的,没必要,干掉。
再次启动访问http://127.0.0.1:9200 ,可以直接打开使用。
Download Elasticsearch
https://www.elastic.co/cn/downloads/elasticsearch
因为这里本机已经安装运行,为了演示从零开始,我们在Windows沙盒中演示,Win10操作系统的沙盒http://www.javacui.com/tool/660.html 。
因为沙盒开始是一个纯净的系统,所以需要安装ZIP工具,安装文本编辑工具方便修改配置文件。
这里下载了elasticsearch-8.2.2-windows-x86_64,可以根据网站提示下载最新版本,虽然ES依赖JDK,但是ES安装文件内置了JDK,因为纯净的系统上无需安装再次安装JDK,直接运行bin下elasticsearch.bat即可。
初次启动,显示的配置信息,一定要保存下来,以备使用。
访问https://127.0.0.1:9200,注意是HTTPS不是HTTP,用户名密码刚才控制台已经打印出来了。
证明安装成功。
问题1:内存直接占满
此时你打开任务管理器,发现一个问题,ES启动后,占据了沙盒的全部内存。我的本机是32G的,启动也是直接打满,导致系统卡爆。
因此我们需要配置启动内存,配置文件conf/jvm.options
################################################################
## IMPORTANT: JVM heap size
################################################################
##
## The heap size is automatically configured by Elasticsearch
## based on the available memory in your system and the roles
## each node is configured to fulfill. If specifying heap is
## required, it should be done through a file in jvm.options.d,
## which should be named with .options suffix, and the min and
## max should be set to the same value. For example, to set the
## heap to 4 GB, create a new file in the jvm.options.d
## directory containing these lines:
##
-Xms1g
-Xmx1g
在这里修改为合适的内存,这里修改为1G,沙盒全部内存是4G,合理配置即可。
问题2:二次启动报错
修改配置文件后,再次启动,这时不会再次打印第一次启动时的配置信息了。但是报错了
[2022-06-16T10:40:55,562][ERROR][o.e.i.g.GeoIpDownloader ] [06A8DD4C-A847-4] exception during geoip databases update
org.elasticsearch.ElasticsearchException: not all primary shards of [.geoip_databases] index are active
at org.elasticsearch.ingest.geoip.GeoIpDownloader.updateDatabases(GeoIpDownloader.java:135) ~[ingest-geoip-8.2.2.jar:8.2.2]
at org.elasticsearch.ingest.geoip.GeoIpDownloader.runDownloader(GeoIpDownloader.java:275) [ingest-geoip-8.2.2.jar:8.2.2]
at org.elasticsearch.ingest.geoip.GeoIpDownloaderTaskExecutor.nodeOperation(GeoIpDownloaderTaskExecutor.java:102) [ingest-geoip-8.2.2.jar:8.2.2]
at org.elasticsearch.ingest.geoip.GeoIpDownloaderTaskExecutor.nodeOperation(GeoIpDownloaderTaskExecutor.java:48) [ingest-geoip-8.2.2.jar:8.2.2]
at org.elasticsearch.persistent.NodePersistentTasksExecutor$1.doRun(NodePersistentTasksExecutor.java:42) [elasticsearch-8.2.2.jar:8.2.2]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:773) [elasticsearch-8.2.2.jar:8.2.2]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) [elasticsearch-8.2.2.jar:8.2.2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.lang.Thread.run(Thread.java:833) [?:?]
因为他启动时会去更新地图的一些数据库,这里直接禁掉即可,用到时再说,配置文件conf/elasticsearch.yml,增加配置
ingest.geoip.downloader.enabled: false
问题3:本地测试不想用用户密码和SSL
本身ES服务器也不会对外开放,增加用户密码和SSL对于初学来说,徒增不必要的麻烦,这里直接干掉,还是那句话,用到再说。
配置文件conf/elasticsearch.yml,修改配置
# Enable security features
xpack.security.enabled: false
xpack.security.enrollment.enabled: false
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
enabled: false
keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
enabled: false
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["06A8DD4C-A847-4"]
# Allow HTTP API connections from anywhere
# Connections are encrypted and require user authentication
http.host: 0.0.0.0
# Allow other nodes to join the cluster from anywhere
# Connections are encrypted and mutually authenticated
#transport.host: 0.0.0.0
原来都是true,这里都改成了false,前面是要求用户登录的,后面是要求SSL的,没必要,干掉。
再次启动访问http://127.0.0.1:9200 ,可以直接打开使用。
2月22
漏洞原理
nginx在配置别名(Alias)的时候忘记加/,则可能实现目录穿越
配置中设置目录别名时/files配置为/home/的别名,那么当我们访问
/files…/时,nginx实际处理的路径时/home/…/,从而实现了穿越目录
location /file{
autoindex on;
alias /home/;
}
所以修复这个漏洞也就是将上面的/file/闭合成这样,就不支持../这些回上一层目录的操作了。
nginx在配置别名(Alias)的时候忘记加/,则可能实现目录穿越
配置中设置目录别名时/files配置为/home/的别名,那么当我们访问
/files…/时,nginx实际处理的路径时/home/…/,从而实现了穿越目录
location /file{
autoindex on;
alias /home/;
}
所以修复这个漏洞也就是将上面的/file/闭合成这样,就不支持../这些回上一层目录的操作了。
1月12
MinIO 服务器配置文件(config.json)存储在 --config-dir 指定的配置目录中,--config-dir 默认值为 ${HOME}/.minio(笔者的目录为 C:\Users\Administrator\.minio)。
但是从 RELEASE.2018-08-18T03-49-57Z 之后的版本开始,配置文件已迁移到存储数据的 .minio.sys/config 目录(存储后端是启动服务器时传递给 MinIO 服务器的目录)。如果使用如下命令启动 MinIO 服务:
minio.exe server D:/tmp/data
则配置文件位于 D:\tmp\data\.minio.sys\config 目录中。
注意:你可以使用 mc -h 命令查看当前 MinIO 的版本信息,如下:
D:\server\minio>mc -h
NAME:
mc - MinIO Client for cloud storage and filesystems.
...
VERSION:
RELEASE.2021-06-13T17-48-22Z
您可以使用 --config-dir 指定现有配置的位置,MinIO 会自动将 config.json 迁移到您的后端存储。您当前 --config-dir 指定的 config.json 配置文件将在成功迁移后重命名为 config.json.deprecated。
如果你的配置文件位于 C:\Users\Administrator\.minio\config.json,MinIO 会自动将 config.json 中的配置迁移到 D:\tmp\data\.minio.sys\config\config.json 文件,然后将 C:\Users\Administrator\.minio\config.json 重命名为 C:\Users\Administrator\.minio\config.json.deprecated。
此外 --config-dir 现在是一个遗留选项,计划在将来删除,因此请相应地更新您的本地启动和 ansible 脚本。使用如下命令去启动 MinIO 服务:
minio.exe server D:\tmp\data
上面命令,将创建的存储桶以及存储桶中的对象放到 D:\tmp\data 目录,并且配置信息均位于 D:\tmp\data\.minio.sys 目录。
但是从 RELEASE.2018-08-18T03-49-57Z 之后的版本开始,配置文件已迁移到存储数据的 .minio.sys/config 目录(存储后端是启动服务器时传递给 MinIO 服务器的目录)。如果使用如下命令启动 MinIO 服务:
minio.exe server D:/tmp/data
则配置文件位于 D:\tmp\data\.minio.sys\config 目录中。
注意:你可以使用 mc -h 命令查看当前 MinIO 的版本信息,如下:
D:\server\minio>mc -h
NAME:
mc - MinIO Client for cloud storage and filesystems.
...
VERSION:
RELEASE.2021-06-13T17-48-22Z
您可以使用 --config-dir 指定现有配置的位置,MinIO 会自动将 config.json 迁移到您的后端存储。您当前 --config-dir 指定的 config.json 配置文件将在成功迁移后重命名为 config.json.deprecated。
如果你的配置文件位于 C:\Users\Administrator\.minio\config.json,MinIO 会自动将 config.json 中的配置迁移到 D:\tmp\data\.minio.sys\config\config.json 文件,然后将 C:\Users\Administrator\.minio\config.json 重命名为 C:\Users\Administrator\.minio\config.json.deprecated。
此外 --config-dir 现在是一个遗留选项,计划在将来删除,因此请相应地更新您的本地启动和 ansible 脚本。使用如下命令去启动 MinIO 服务:
minio.exe server D:\tmp\data
上面命令,将创建的存储桶以及存储桶中的对象放到 D:\tmp\data 目录,并且配置信息均位于 D:\tmp\data\.minio.sys 目录。