- list consumer group members
kafka-consumer-groups --describe --bootstrap-server localhost:9092 --group g1 --members
When it's time to refresh, competing for the asynchronous loading with the specified loader. If the loading thread is immediately done, returning the new value. Otherwise returning the current living value. Finally, the cache will be updated with the loading value.
root@localhost:~# python3.7 -m timeit -s 'x = 6' 'f"{x}"'
5000000 loops, best of 5: 79 nsec per loop
root@localhost:~# python3.7 -m timeit -s 'x = 6' 'str(x)'
1000000 loops, best of 5: 214 nsec per loop
# 汇总hdfs web上文件大小 | |
def hdfs_file_size(path): | |
s_data = open(path).read() | |
data = s_data.split('\n') | |
s_size = tuple(r.split('\t')[3].split(' ')[0] for r in data if r) | |
return sum(map(float, s_size)) | |
# 打开yarn任务页面 | |
def open_yarn_application_page(app_name): | |
import requests |
drop table if exists s_test_mysql_auto_increment; | |
create table s_test_mysql_auto_increment(id int primary key auto_increment, value int); | |
insert into s_test_mysql_auto_increment(value) values (10000); | |
SELECT `AUTO_INCREMENT` | |
FROM INFORMATION_SCHEMA.TABLES | |
WHERE TABLE_NAME = 's_test_mysql_auto_increment'; | |
insert into s_test_mysql_auto_increment(value) values (10001); | |
SELECT `AUTO_INCREMENT` |
ipython profile create default
# Use rewrite directive | |
location ^~ /apps/ { | |
rewrite ^/apps/(.*) /$1 break; | |
proxy_pass http://127.0.0.1:3000$uri$is_args$args; | |
} | |
# Use location path match | |
location ^~ /apps/ { | |
proxy_pass http://127.0.0.1:3000/; |
function show_haproxy_socket_info(){ | |
ret=$(ss -tnlp|grep haproxy) | |
echo $ret | |
pstr=$(echo $ret | awk -F'\t' '{split($NF, a, ","); split(a[2], b, "="); split(a[3], c, "="); split(c[2], d, ")"); print b[2], d[1]}') | |
IFS=' ' | |
read -r -a array <<< "$pstr" | |
pid="${array[0]}" |