当前位置: 首页 > news >正文

定制一款app要多少钱沧州网站建设优化

定制一款app要多少钱,沧州网站建设优化,中国建设网官方网站证书查询,云主机做网站域名打不开一、使用Docker启动的Redis容器使用的配置文件路径等问题 1.docker启动的redis使用的配置文件路径是什么 使用docker搭建redis服务,本身redis启动的时候可以指定配置文件的, redis-server /指定配置文件路径/redis.conf。 但手上也没有一个redis配置文件…

一、使用Docker启动的Redis容器使用的配置文件路径等问题

1.docker启动的redis使用的配置文件路径是什么

        使用docker搭建redis服务,本身redis启动的时候可以指定配置文件的, redis-server /指定配置文件路径/redis.conf。 但手上也没有一个redis配置文件。

        在使用非docker安装时,redis的安装包里到是有redis.conf默认文件,但使用docker安装时,不好直接找到啊。没法使用redis本身自带的redis.conf。于是直接启动一个redis服务(不指定配置文件)

docker run -itd \
--name redis7 \
--privileged=true \
--restart=always \
-p 6379:6379 \
-v /opt/redis/data:/data \
-v /opt/redis7/conf/redis.conf:/etc/redis/redis.conf \
redis:latest redis-server /etc/redis/redis.conf --appendonly yes

        启动之后,使用info server查看,config_file为空,没有使用任何配置文件。

executable:/data/redis-server
config_file:

        所以整理一个精简的redis配置文件放在这里吧。docker搭建redis7.2时可使用的精简redis.conf配置文件

[#root] cat /opt/redis7/conf/redis.conf
port 6379
daemonize no
databases 1
tcp-backlog 128
tcp-keepalive 300
logfile "/data/redis.log"
syslog-enabled yes
crash-log-enabled yes
timeout 0
maxmemory 4gb
maxmemory-policy volatile-lru
save 3600 1 300 100 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
# syslog-ident redis
# requirepass foobared
# maxclients 10000

2.Redis启动时警告:Memory overcommit must be enabled

WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

docker exec redis7.2 sysctl vm.overcommit_memory=1

3.docker搭建redis服务时daemonize设置为no

        docker搭建redis服务时daemonize设置为no,为YES的时候redis启动不了。默认值为no 为不守护进程模式,如果是直接在宿主机启动.

4.发现python项目里多了个venv文件夹

        python3.3之后,可以用模块 venv 代替 virtualenv 工具创建、删除虚拟环境。venv就是一个虚拟python环境的文件夹。可以实现多个项目使用不同的python环境。

二、Python使用clickhouse_driver操作clickhouse数据库

    Python要实现使用clickhouse_driver操作clickhouse数据库,首先需要安装clickhouse_driver模块:pip install clickhouse_driver PIP安装的时候有时会遇到报警:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fd06b379a90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/clickhouse-driver/。

        如果不是在DOCKER容器中一般可以通过指定PIP源的方法解决,如果是在docker容器中一般要修改docker中的DNS地址,可在本CSDN博客中搜索我的文章内容。

from clickhouse_driver import Client
#可以再加个连接超时时间send_receive_timeout=send_receive_timeout
client = Client(host=host, port=port, user=user, password=password,database=database)
result = client.execute("select * from 数据库.表 limit 10")
print(result)

    连接的时候可能碰到报错:

File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 437, in receive_hello raise errors.UnexpectedPacketFromServerError(message)
clickhouse_driver.errors.UnexpectedPacketFromServerError: Code: 102. Unexpected packet from server None:None (expected Hello or Exception, got Unknown packet)

        这是因为端口使用错误导致,clickhouse有两个端口,8123和9000。分别用于接收 http协议和tcp协议请求,管理后台登录用的8123(jdbc连接),而程序连接clickhouse(driver连接)则需要使用9000端口。如果在程序中使用8123端口连接就会报错:

clickhouse_driver.errors.UnexpectedPacketFromServerError: Code: 102. Unexpected packet from server None:None (expected Hello or Exception, got Unknown packet)

 

http://www.yayakq.cn/news/750328/

相关文章:

  • 个人网站 论坛绿茶直播
  • 有哪些档案网站wordpress html5 中文
  • 怎么建网站详细步骤wordpress修改文章id
  • 做网站排版网站的弹窗对话框怎么做
  • 大学网站建设专业微信小程序开发实战课后答案
  • 企业网站实名审核中心wordpress装修模板
  • 自己建设房源网站门户网站如何建设
  • 网站可以增加关键词吗seo黑帽教程视频
  • 铜仁网站优化广告设计专业简历
  • 网站运营难做嘛上海建设工程有限公司
  • 海南哪家公司做网站平安建设网站
  • 打代码怎么做网站网站开发人员的工资
  • 上海先进网站设计沁水网站建设
  • 网站ip解析网上做网站的
  • 吕子乔做网站一段台词中山免备案网站建设
  • 网站建设毕业设计的分类号法治网站的建设整改措施
  • 化妆培训学校网站开发广州建设网站公司
  • 外贸开发模板网站模板wordpress 二维码插件下载地址
  • 民治营销型网站制作定制网络接口报警灯生产厂商
  • 专业网站制作软件wordpress和shopify
  • html代码大全网站推荐常德哪里有做网站
  • 苏州市智信建设职业培训学校网站动漫设计视频
  • 企业网站代码重庆做网站熊掌号
  • 大连网站建设是什么汕头市广州新业建设有限公司网站
  • 印刷网站建设价格网站建设如何导入音乐
  • php 手机网站cms贵池区城乡与住房建设网站
  • 佛山最好的网站建设12306网站 花了多少钱建设
  • 网站怎么做邮箱wordpress互动游戏
  • 简述营销型网站开发流程郑州宣传片制作多少钱
  • 网站原型设计和版式设计婚纱摄影网站的设计