2020年7月

redis批量导入

cat test.txt
a,1
b,2
c,3
cat test.txt | awk -F "," '{print $1" "$2" "$3" "$4}'
a 1
b 2
c 3
cat ../test.txt | awk -F "," '{print $1" "$2}' | xargs -n4 sh -c 'src/redis-cli set $1 $2' sh
cat ../test.txt | awk -F "," '{print "set "$1" "$2}' | src/redis-cli --pipe
cat ../f0.txt | awk -F "," '{print "set "$1" "$2}' | src/redis-cli --pipe
time cat ../f0.txt | awk -F "," '{print "set "$1" "$2}' | src/redis-cli -n 0 --pipe

挂载exFat分区

原来也不是直接可以挂载的,还要装点儿东西
sudo apt-get install exfat-fuse
然后就可以挂啦
sudo mount /dev/sda /mnt/usb_flash

单机HBase

http://www.apache.org/dyn/closer.cgi/hbase/
https://mirror.bit.edu.cn/apache/hbase/
https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/
wget https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/hbase-1.3.6/hbase-1.3.6-bin.tar.gz
tar zxf hbase-1.3.6-bin.tar.gz
mv hbase-1.3.6 hbase

sudo vi /etc/profile 添加

export HBASE_HOME=/home/user/hbase
export PATH=$HBASE_HOME/bin:$PATH

source /etc/profile
hbase version
HBase 1.3.6

Source code repository git://Sakthis-MacBook-Pro-2.local/Users/sakthi/dev/hbase revision=806dc3625c96fe2cfc03048f3c54a0b38bc9e984
Compiled by sakthi on Tue Oct 15 01:55:41 PDT 2019
From source with checksum d587feefff2057a2e5001da5db4a6fac

JDK要配好java -version

vi /home/user/hbase/conf/hbase-env.sh

export JAVA_HOME=/home/user/miku/jdk
export HBASE_MANAGES_ZK=true

vi /home/user/hbase/conf/hbase-site.xml

<configuration>
    <property>
        <name>hbase.rootdir</name>
        <value>file:/home/user/miku/data</value>
    </property>
    <property>
        <name>hbase.zookeeper.property.dataDir</name>
        <value>file:/home/user/miku/data/zookeeper</value>
    </property>
</configuration>

/home/user/hbase/bin/start-hbase.sh # stop-hbase.sh 停止
hbase shell

status
create 'table1','field1'
t1 = get_table('table1')
t1.put 'row1', 'field1:qualifier1', 'value1'
t1.scan

参考:
https://blog.csdn.net/ouzhuangzhuang/article/details/89876152

不睡觉

docker run -ti --name host01 -v /home/user/miku:/miku -p 30122:22 ubuntu

1、安装Java JDK

转外
wget https://mirrors.huaweicloud.com/java/jdk/8u202-b08/jdk-8u202-linux-x64.tar.gz
tar -zxvf jdk-8u202-linux-x64.tar.gz
mv jdk1.8.0_202/ jdk
转内
cp /etc/profile /miku
转外
sudo vi profile
尾部添加
# JDK,TOMCAT,ORACLE
export JAVA_HOME=/miku/jdk
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin
转内
cp /miku/profile /etc/profile
source /etc/profile
java -version

- 阅读剩余部分 -

mysql load data infile 导入 csv 文件

load data infile '/home/user/OK3a/WW.txt' into table dmpa_test fields terminated by ',';

ERROR 1045 (28000): Access denied for user 'pguser'@'%' (using password: YES)
ERROR 1146 (42S02): Table 'QGDB.dmpa_test' doesn't exist
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
show variables like '%secure%';
sudo mv /home/user/OK3a/WW.txt /var/lib/mysql-files/
load data infile '/var/lib/mysql-files/WW.txt' into table dmpa_test fields terminated by ',';
ERROR 1262 (01000): Row 1 was truncated; it contained more data than there were input columns
load data infile '/var/lib/mysql-files/00.txt' into table dmpa_test fields terminated by ',';

show variables like 'sql_mode';
load data infile '/var/lib/mysql-files/00.txt' into table dmpa_test fields terminated by ',' enclosed by '"';
[Err] 1262 - Row 1 was truncated; it contained more data than there were input columns
load data infile '/var/lib/mysql-files/00.txt' into table dmpa_test fields terminated by ',' optionally enclosed by "'" lines terminated by '\r\n' IGNORE 1 LINES ;
[Err] 1262 - Row 371126 was truncated; it contained more data than there were input columns

参考:
https://www.cnblogs.com/waynechou/p/7794939.html