LeetCode - 136. Single Number
题目
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Write a function that reverses a string. The input string is given as an array of characters char[].
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.
Example 1:
You’re given strings J
representing the types of stones that are jewels, and S
representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels.
The letters in J
are guaranteed distinct, and all characters in J
and S
are letters. Letters are case sensitive, so "a"
is considered a different type of stone from "A"
.
有时候我们想要在Logstash里对收集到的日志等信息进行分割,并且将分割后的字符作为新的字符来index到Elasticsearch里。假定需求如下:
Logstash收集到的日志字段message
的值是由多个字段拼接而成的,分隔符是;,;
,如下:
在使用Elasticsearch进行index数据时,发现报错如下:
|
|
Elasticsearch默认会配置1G的JVM堆的初始值和最大值,该jvm参数被配置在/config/jvm.options
里:
|
|
如果只是个人开发小项目,可以把参数改小些,比如:
|
|
这个jvm.options
用来配置各种jvm参数,比如GC、GC logging、heap dumps等。
Kibana在创建Index Patterns
的时候,可以选择某个date类型的field作为排序字段。之后在Discover
里打开对应的index,会发现这个date类型的field的格式显示如下:
|
|
这是Kibana默认的日期格式,有两种修改的方式。
最近公司分了个ELK相关的任务给我,在一边学习一边工作之余,总结下这些天来的学习历程和踩坑记录。
首先介绍下使用ELK的项目背景:在项目的数据库里有个表用来存储消息队列的消费日志,这些日志用于开发者日后的维护。每当客户端生产一条消息并发送到消息队列后,就会插入一条对应的记录到数据库里。当这条消息被消费之后,又会更新数据库里对应的记录的几个column的值,比如status、updated_on这些常用的column。
由于客户每天生产消费的消息很多,导致数据库里的这个表里的数据很多,长年累月下来,会达到数以亿计。领导决定不再把这些消费日志保存到数据库,而是改为通过Log4j2 + ELK架构把这些日志保存到Elasticsearch里。
ELk是Elasticsearch + Logstash + Kibana
的缩写,ELK一般用来收集分布式架构下各个节点的日志,并进行统一地管理。
|
|