mysql与jmeter环境变量配置_Java开发技术大杂烩(一)之Redis、Jmeter、MySQL的那些事...
前言
畢業答辯告一段落,接下來好好努力工作。
Redis遇到的一些問題
DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.
這是redis的保護機制,連接redis只能是127.0.0.1這個ip,我們遠程連接是拒絕的。所以我們需要在redis.conf進行如下配置。
1.配置protected-mode no,禁用redis默認保護機制。
2.配置daemonize yes,讓redis后臺啟動。
3.注釋掉bind 127.0.0.1這行代碼
4.然后通過指定配置文件啟動方式啟動redis。
redis-server redis.conf
5.通過telnet 111.230.11.184 6379,發現遠程登錄成功。
Jmeter遇到的一些問題
1.設置Jmeter在linux上環境變量,vim /etc/profile,進行如下配置,然后source /etc/profile保存配置讓其生效。
export JMETER_HOME=/usr/local/apache-jmeter-4.0
export CLASSPATH=$JMETER_HOME/lib/ext/ApacheJMeter_core.jar:$JMETER_HOME/lib/jorphan.jar:$CLASSPATH
export PATH=$JMETER_HOME/bin:$PATH
MySQL遇到的問題
1.當我在做秒殺商品壓測的時候,發現會頻繁的訪問數據庫。于是將數據源連接池中的spring.datasource.druid.inital-size(初始化連接)設置為500,spring.datasource.druid.min.idle(最小空閑連接,連接池容許保持空閑狀態的最小連接,低于這個數量將會創建新的連接)設置為500,spring.datasource.druid.max-active(最大活動連接,連接池在同一時間能夠分配的最大活動連接的數量)設置為1000。然后看輸出臺拋出了Data source rejected establishment of connection, message from server: "Too many connections"。這是由于太多的連接數量超過了mysql默認的連接數,我們只需要在/etc/my.cnf添加如下配置(初始化連接數設置的過大,會導致應用啟動變得很慢):
max_connections=1000 所有用戶連接數的最大值
max_user_connections=520 單一用戶連接數的最大值
wait_timeout=60 60s后關閉空閑連接,對正在工作的連接不受影響
3.學習Linux命令:netstat -anp|grep 8086,查看占用8086端口的程序的pid。
4.學習Linux命令 :cat /var/log/mysqld.log|grep ERROR,查看mysqld.log日志文件中ERROR級別的日志內容。
5.學習Linux命令:mysql -uroot -p,登錄mysql。SHOW VARIABLES LIKE "%max%connec%",查看參數配置。
6.當我在linux下,登錄mysql后,輸入show databases,發現沒有反應。百度后,發現必須要在每行命令結尾加上 \g。
7.學習Linux命令:cat /proc/meminfo,查看linux服務器當前可用內存。真正可用的內存=MemFree+Buffers+Cached
尾言
mayday
總結
以上是生活随笔為你收集整理的mysql与jmeter环境变量配置_Java开发技术大杂烩(一)之Redis、Jmeter、MySQL的那些事...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 有限合伙可以不备案吗(有限合伙不备案违法
- 下一篇: mysql备份七牛云存储_定时备份 My