This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
show full PROCESSLIST; | |
#查询及设置最大连接数 | |
show variables like '%max_connections%'; | |
set global max_connections=1000; | |
#按ip统计连接数 | |
select SUBSTRING_INDEX(host,':',1) as ip , count(*) from information_schema.processlist group by ip; | |
#按pid统计与MySQL的tcp连接 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.util.Iterator 对 collection 进行迭代的迭代器。 | |
java.util.Iterator it = map.entrySet().iterator(); | |
while(it.hasNext()){ | |
java.util.Map.Entry entry = (java.util.Map.Entry)it.next(); | |
entry.getKey() //返回对应的键 | |
entry.getValue() //返回对应的值 | |
} | |
Map<String,String> testData = new HashMap<String, String>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.flink.api.common.functions.ReduceFunction | |
import org.apache.flink.api.common.state.{ReducingState, ReducingStateDescriptor} | |
import org.apache.flink.api.common.typeutils.base.LongSerializer | |
import org.apache.flink.streaming.api.TimeCharacteristic | |
import org.apache.flink.streaming.api.windowing.triggers.Trigger.TriggerContext | |
import org.apache.flink.streaming.api.windowing.triggers._ | |
import org.apache.flink.streaming.api.windowing.windows.TimeWindow | |
import org.apache.hadoop.hbase.util.Bytes | |
import org.slf4j.{Logger, LoggerFactory} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.collect.Maps; | |
import org.apache.hadoop.hbase.Cell; | |
import org.apache.hadoop.hbase.CellUtil; | |
import org.apache.hadoop.hbase.client.Put; | |
import org.apache.hadoop.hbase.util.Bytes; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import java.util.List; | |
import java.util.Map; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.collect.Maps; | |
import org.apache.hadoop.hbase.util.Bytes; | |
import java.util.Collection; | |
import java.util.HashMap; | |
import java.util.Map; | |
/** | |
* 各种Put的集合,包含表信息 | |
*/ | |
public class PutCollection { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.collect.Lists; | |
import org.apache.flink.api.common.io.RichOutputFormat; | |
import org.apache.flink.configuration.Configuration; | |
import org.apache.hadoop.hbase.TableName; | |
import org.apache.hadoop.hbase.client.Connection; | |
import org.apache.hadoop.hbase.client.ConnectionFactory; | |
import org.apache.hadoop.hbase.client.Put; | |
import org.apache.hadoop.hbase.client.Table; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on duplicate key update file_name = values(file_name) | |
file_name应该是唯一索引 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FixedSqlSessionFactory extends SqlSessionFactoryBean { | |
@Override | |
protected SqlSessionFactory buildSqlSessionFactory() throws IOException { | |
try { | |
return super.buildSqlSessionFactory(); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} finally { | |
ErrorContext.instance().reset(); | |
} |